From patchwork Thu Nov 26 19:44:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 7708811 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 216359F2E9 for ; Thu, 26 Nov 2015 19:45:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 56A6220657 for ; Thu, 26 Nov 2015 19:45:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 60EC7205DD for ; Thu, 26 Nov 2015 19:45:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753348AbbKZTpB (ORCPT ); Thu, 26 Nov 2015 14:45:01 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:49469 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751481AbbKZTpA (ORCPT ); Thu, 26 Nov 2015 14:45:00 -0500 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id tAQJivZY021565 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 26 Nov 2015 19:44:58 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.13.8/8.13.8) with ESMTP id tAQJivQo005141 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Thu, 26 Nov 2015 19:44:57 GMT Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by userv0122.oracle.com (8.13.8/8.13.8) with ESMTP id tAQJiuPx023564; Thu, 26 Nov 2015 19:44:57 GMT Received: from mwanda (/154.0.139.178) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 26 Nov 2015 11:44:56 -0800 Date: Thu, 26 Nov 2015 22:44:51 +0300 From: Dan Carpenter To: Johannes Berg Cc: linux-wireless@vger.kernel.org Subject: Re: (bug report) iwlwifi: inconsitent NULL checking Message-ID: <20151126194451.GH7289@mwanda> References: <20151126120317.GJ10556@mwanda> <1448540211.2167.7.camel@sipsolutions.net> <20151126123756.GF7289@mwanda> <1448542297.2167.10.camel@sipsolutions.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1448542297.2167.10.camel@sipsolutions.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: userv0021.oracle.com [156.151.31.71] Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There are two issues in Smatch that would need to be fixed: If apply that patch (with changes for your system) and run kchecker drivers/net/wireless/intel/iwlwifi/mvm/rs.c then it prints: drivers/net/wireless/intel/iwlwifi/mvm/rs.c:2800 rs_get_rate() implied: lq_sta = '0,4096-2117777777777777777' drivers/net/wireless/intel/iwlwifi/mvm/rs.c:2805 rs_get_rate() implied: mvm_sta = 's64min-(-1),1-s64max' The first problem is that it doesn't see that if mvm_sta is non-NULL then that implies lq_sta is non-NULL. But even if that worked, after we do the function call, it sees that the function that mvm_sta is non-NULL but it wouldn't see that that means lq_sta is non-NULL. It's not so terribly far from working but it's not there yet. regards, dan carpenter --- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c index d1ad103..d3bc193 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c @@ -2767,6 +2767,7 @@ static void rs_initialize_lq(struct iwl_mvm *mvm, iwl_mvm_send_lq_cmd(mvm, &lq_sta->lq, init); } +#include "/home/dcarpenter/progs/smatch/devel/check_debug.h" static void rs_get_rate(void *mvm_r, struct ieee80211_sta *sta, void *mvm_sta, struct ieee80211_tx_rate_control *txrc) { @@ -2795,9 +2796,13 @@ static void rs_get_rate(void *mvm_r, struct ieee80211_sta *sta, void *mvm_sta, mvm_sta = NULL; } + if (mvm_sta) + __smatch_implied(lq_sta); + /* Send management frames and NO_ACK data using lowest rate. */ if (rate_control_send_low(sta, mvm_sta, txrc)) return; + __smatch_implied(mvm_sta); iwl_mvm_hwrate_to_tx_rate(lq_sta->last_rate_n_flags, info->band, &info->control.rates[0]);