From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755775AbdJJAGM (ORCPT ); Mon, 9 Oct 2017 20:06:12 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:39643 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755488AbdJJAGL (ORCPT ); Mon, 9 Oct 2017 20:06:11 -0400 X-ME-Sender: X-Sasl-enc: QRdixTq5hGmHulc9WZgTnd10wEwg1jRKSAaKehAh15U/ 1507593969 Date: Tue, 10 Oct 2017 11:06:07 +1100 From: "Tobin C. Harding" To: Shreeya Patel Cc: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] Staging: rtlwifi: Remove NULL pointer dereference Message-ID: <20171010000607.GA29970@eros> References: <1507583938-13272-1-git-send-email-shreeya.patel23498@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1507583938-13272-1-git-send-email-shreeya.patel23498@gmail.com> X-Mailer: Mutt 1.5.24 (2015-08-30) User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 10, 2017 at 02:48:58AM +0530, Shreeya Patel wrote: > Remove NULL pointer dereference as it results in undefined > behaviour, and will usually lead to a runtime error. The diff does not show any pointer dereference so it is hard to understand what you are trying to do with this patch. > Signed-off-by: Shreeya Patel > --- > drivers/staging/rtlwifi/base.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/rtlwifi/base.c b/drivers/staging/rtlwifi/base.c > index b88b0e8..5bb8f98 100644 > --- a/drivers/staging/rtlwifi/base.c > +++ b/drivers/staging/rtlwifi/base.c > @@ -781,7 +781,7 @@ static void _rtl_txrate_selectmode(struct ieee80211_hw *hw, > > struct rtl_priv *rtlpriv = rtl_priv(hw); > struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); > - struct rtl_sta_info *sta_entry = NULL; > + struct rtl_sta_info *sta_entry; Now the pointer just has garbage in it instead of the testable value of NULL. If you are concerned with the dereference perhaps you could add a NULL check, again it's hard to say without seeing the code. It is hard to see how this patch is correct though. Hope this helps, Tobin.