* [PATCH] Staging: rtlwifi: Remove NULL pointer dereference
@ 2017-10-09 21:18 Shreeya Patel
2017-10-10 0:06 ` Tobin C. Harding
2017-10-11 19:11 ` kbuild test robot
0 siblings, 2 replies; 6+ messages in thread
From: Shreeya Patel @ 2017-10-09 21:18 UTC (permalink / raw)
To: gregkh, devel, linux-kernel; +Cc: Shreeya Patel
Remove NULL pointer dereference as it results in undefined
behaviour, and will usually lead to a runtime error.
Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
---
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;
u8 ratr_index = SET_RATE_ID(RATR_INX_WIRELESS_MC);
if (sta) {
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] Staging: rtlwifi: Remove NULL pointer dereference
2017-10-09 21:18 [PATCH] Staging: rtlwifi: Remove NULL pointer dereference Shreeya Patel
@ 2017-10-10 0:06 ` Tobin C. Harding
2017-10-11 12:32 ` Shreeya Patel
2017-10-11 19:11 ` kbuild test robot
1 sibling, 1 reply; 6+ messages in thread
From: Tobin C. Harding @ 2017-10-10 0:06 UTC (permalink / raw)
To: Shreeya Patel; +Cc: gregkh, devel, linux-kernel
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 <shreeya.patel23498@gmail.com>
> ---
> 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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Staging: rtlwifi: Remove NULL pointer dereference
2017-10-10 0:06 ` Tobin C. Harding
@ 2017-10-11 12:32 ` Shreeya Patel
2017-10-12 2:16 ` Tobin C. Harding
0 siblings, 1 reply; 6+ messages in thread
From: Shreeya Patel @ 2017-10-11 12:32 UTC (permalink / raw)
To: Tobin C. Harding; +Cc: gregkh, devel, linux-kernel
On Tue, 2017-10-10 at 11:06 +1100, Tobin C. Harding wrote:
> 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 <shreeya.patel23498@gmail.com>
> > ---
> > 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.
Hello,
Thanks for making me understand.
Here is the code after declaration and initialization of sta_entry.
Will it be good to add a NULL check in this case?
struct rtl_sta_info *sta_entry = NULL;
u8 ratr_index = SET_RATE_ID(RATR_INX_WIRELESS_MC);
if (sta) {
sta_entry = (struct rtl_sta_info *)sta->drv_priv;
ratr_index = sta_entry->ratr_index;
}
If we are making a pointer point to NULL then what if any other
variable is already pointing to NULL for some other purpose.
Instead, removing initialization will be good right?
>
> It is hard to see how this patch is correct though.
>
> Hope this helps,
> Tobin.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Staging: rtlwifi: Remove NULL pointer dereference
2017-10-09 21:18 [PATCH] Staging: rtlwifi: Remove NULL pointer dereference Shreeya Patel
2017-10-10 0:06 ` Tobin C. Harding
@ 2017-10-11 19:11 ` kbuild test robot
1 sibling, 0 replies; 6+ messages in thread
From: kbuild test robot @ 2017-10-11 19:11 UTC (permalink / raw)
To: Shreeya Patel; +Cc: kbuild-all, gregkh, devel, linux-kernel, Shreeya Patel
[-- Attachment #1: Type: text/plain, Size: 7949 bytes --]
Hi Shreeya,
[auto build test WARNING on staging/staging-testing]
[also build test WARNING on v4.14-rc4 next-20171009]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Shreeya-Patel/Staging-rtlwifi-Remove-NULL-pointer-dereference/20171012-021213
config: alpha-allyesconfig (attached as .config)
compiler: alpha-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=alpha
Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings
All warnings (new ones prefixed by >>):
drivers/staging//rtlwifi/base.c: In function 'rtl_get_tcb_desc':
>> drivers/staging//rtlwifi/base.c:778:26: warning: 'sta_entry' may be used uninitialized in this function [-Wmaybe-uninitialized]
(sta_entry ? sta_entry->wireless_mode : \
^~
drivers/staging//rtlwifi/base.c:784:23: note: 'sta_entry' was declared here
struct rtl_sta_info *sta_entry;
^~~~~~~~~
vim +/sta_entry +778 drivers/staging//rtlwifi/base.c
56bde846 Ping-Ke Shih 2017-08-17 770
56bde846 Ping-Ke Shih 2017-08-17 771 static void _rtl_txrate_selectmode(struct ieee80211_hw *hw,
56bde846 Ping-Ke Shih 2017-08-17 772 struct ieee80211_sta *sta,
56bde846 Ping-Ke Shih 2017-08-17 773 struct rtl_tcb_desc *tcb_desc)
56bde846 Ping-Ke Shih 2017-08-17 774 {
56bde846 Ping-Ke Shih 2017-08-17 775 #define SET_RATE_ID(rate_id) \
56bde846 Ping-Ke Shih 2017-08-17 776 ((rtlpriv->cfg->spec_ver & RTL_SPEC_NEW_RATEID) ? \
56bde846 Ping-Ke Shih 2017-08-17 777 rtl_mrate_idx_to_arfr_id(hw, rate_id, \
56bde846 Ping-Ke Shih 2017-08-17 @778 (sta_entry ? sta_entry->wireless_mode : \
56bde846 Ping-Ke Shih 2017-08-17 779 WIRELESS_MODE_G)) : \
56bde846 Ping-Ke Shih 2017-08-17 780 rate_id)
56bde846 Ping-Ke Shih 2017-08-17 781
56bde846 Ping-Ke Shih 2017-08-17 782 struct rtl_priv *rtlpriv = rtl_priv(hw);
56bde846 Ping-Ke Shih 2017-08-17 783 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
f651dc66 Shreeya Patel 2017-10-10 784 struct rtl_sta_info *sta_entry;
56bde846 Ping-Ke Shih 2017-08-17 785 u8 ratr_index = SET_RATE_ID(RATR_INX_WIRELESS_MC);
56bde846 Ping-Ke Shih 2017-08-17 786
56bde846 Ping-Ke Shih 2017-08-17 787 if (sta) {
56bde846 Ping-Ke Shih 2017-08-17 788 sta_entry = (struct rtl_sta_info *)sta->drv_priv;
56bde846 Ping-Ke Shih 2017-08-17 789 ratr_index = sta_entry->ratr_index;
56bde846 Ping-Ke Shih 2017-08-17 790 }
56bde846 Ping-Ke Shih 2017-08-17 791 if (!tcb_desc->disable_ratefallback || !tcb_desc->use_driver_rate) {
56bde846 Ping-Ke Shih 2017-08-17 792 if (mac->opmode == NL80211_IFTYPE_STATION) {
56bde846 Ping-Ke Shih 2017-08-17 793 tcb_desc->ratr_index = 0;
56bde846 Ping-Ke Shih 2017-08-17 794 } else if (mac->opmode == NL80211_IFTYPE_ADHOC ||
56bde846 Ping-Ke Shih 2017-08-17 795 mac->opmode == NL80211_IFTYPE_MESH_POINT) {
56bde846 Ping-Ke Shih 2017-08-17 796 if (tcb_desc->multicast || tcb_desc->broadcast) {
56bde846 Ping-Ke Shih 2017-08-17 797 tcb_desc->hw_rate =
56bde846 Ping-Ke Shih 2017-08-17 798 rtlpriv->cfg->maps[RTL_RC_CCK_RATE2M];
56bde846 Ping-Ke Shih 2017-08-17 799 tcb_desc->use_driver_rate = 1;
56bde846 Ping-Ke Shih 2017-08-17 800 tcb_desc->ratr_index =
56bde846 Ping-Ke Shih 2017-08-17 801 SET_RATE_ID(RATR_INX_WIRELESS_MC);
56bde846 Ping-Ke Shih 2017-08-17 802 } else {
56bde846 Ping-Ke Shih 2017-08-17 803 tcb_desc->ratr_index = ratr_index;
56bde846 Ping-Ke Shih 2017-08-17 804 }
56bde846 Ping-Ke Shih 2017-08-17 805 } else if (mac->opmode == NL80211_IFTYPE_AP) {
56bde846 Ping-Ke Shih 2017-08-17 806 tcb_desc->ratr_index = ratr_index;
56bde846 Ping-Ke Shih 2017-08-17 807 }
56bde846 Ping-Ke Shih 2017-08-17 808 }
56bde846 Ping-Ke Shih 2017-08-17 809
56bde846 Ping-Ke Shih 2017-08-17 810 if (rtlpriv->dm.useramask) {
56bde846 Ping-Ke Shih 2017-08-17 811 tcb_desc->ratr_index = ratr_index;
56bde846 Ping-Ke Shih 2017-08-17 812 /* TODO we will differentiate adhoc and station future */
56bde846 Ping-Ke Shih 2017-08-17 813 if (mac->opmode == NL80211_IFTYPE_STATION ||
56bde846 Ping-Ke Shih 2017-08-17 814 mac->opmode == NL80211_IFTYPE_MESH_POINT) {
56bde846 Ping-Ke Shih 2017-08-17 815 tcb_desc->mac_id = 0;
56bde846 Ping-Ke Shih 2017-08-17 816
56bde846 Ping-Ke Shih 2017-08-17 817 if (sta &&
56bde846 Ping-Ke Shih 2017-08-17 818 (rtlpriv->cfg->spec_ver & RTL_SPEC_NEW_RATEID))
56bde846 Ping-Ke Shih 2017-08-17 819 ; /* use sta_entry->ratr_index */
56bde846 Ping-Ke Shih 2017-08-17 820 else if (mac->mode == WIRELESS_MODE_AC_5G)
56bde846 Ping-Ke Shih 2017-08-17 821 tcb_desc->ratr_index =
56bde846 Ping-Ke Shih 2017-08-17 822 SET_RATE_ID(RATR_INX_WIRELESS_AC_5N);
56bde846 Ping-Ke Shih 2017-08-17 823 else if (mac->mode == WIRELESS_MODE_AC_24G)
56bde846 Ping-Ke Shih 2017-08-17 824 tcb_desc->ratr_index =
56bde846 Ping-Ke Shih 2017-08-17 825 SET_RATE_ID(RATR_INX_WIRELESS_AC_24N);
56bde846 Ping-Ke Shih 2017-08-17 826 else if (mac->mode == WIRELESS_MODE_N_24G)
56bde846 Ping-Ke Shih 2017-08-17 827 tcb_desc->ratr_index =
56bde846 Ping-Ke Shih 2017-08-17 828 SET_RATE_ID(RATR_INX_WIRELESS_NGB);
56bde846 Ping-Ke Shih 2017-08-17 829 else if (mac->mode == WIRELESS_MODE_N_5G)
56bde846 Ping-Ke Shih 2017-08-17 830 tcb_desc->ratr_index =
56bde846 Ping-Ke Shih 2017-08-17 831 SET_RATE_ID(RATR_INX_WIRELESS_NG);
56bde846 Ping-Ke Shih 2017-08-17 832 else if (mac->mode & WIRELESS_MODE_G)
56bde846 Ping-Ke Shih 2017-08-17 833 tcb_desc->ratr_index =
56bde846 Ping-Ke Shih 2017-08-17 834 SET_RATE_ID(RATR_INX_WIRELESS_GB);
56bde846 Ping-Ke Shih 2017-08-17 835 else if (mac->mode & WIRELESS_MODE_B)
56bde846 Ping-Ke Shih 2017-08-17 836 tcb_desc->ratr_index =
56bde846 Ping-Ke Shih 2017-08-17 837 SET_RATE_ID(RATR_INX_WIRELESS_B);
56bde846 Ping-Ke Shih 2017-08-17 838 else if (mac->mode & WIRELESS_MODE_A)
56bde846 Ping-Ke Shih 2017-08-17 839 tcb_desc->ratr_index =
56bde846 Ping-Ke Shih 2017-08-17 840 SET_RATE_ID(RATR_INX_WIRELESS_G);
56bde846 Ping-Ke Shih 2017-08-17 841
56bde846 Ping-Ke Shih 2017-08-17 842 } else if (mac->opmode == NL80211_IFTYPE_AP ||
56bde846 Ping-Ke Shih 2017-08-17 843 mac->opmode == NL80211_IFTYPE_ADHOC) {
56bde846 Ping-Ke Shih 2017-08-17 844 if (sta) {
56bde846 Ping-Ke Shih 2017-08-17 845 if (sta->aid > 0)
56bde846 Ping-Ke Shih 2017-08-17 846 tcb_desc->mac_id = sta->aid + 1;
56bde846 Ping-Ke Shih 2017-08-17 847 else
56bde846 Ping-Ke Shih 2017-08-17 848 tcb_desc->mac_id = 1;
56bde846 Ping-Ke Shih 2017-08-17 849 } else {
56bde846 Ping-Ke Shih 2017-08-17 850 tcb_desc->mac_id = 0;
56bde846 Ping-Ke Shih 2017-08-17 851 }
56bde846 Ping-Ke Shih 2017-08-17 852 }
56bde846 Ping-Ke Shih 2017-08-17 853 }
56bde846 Ping-Ke Shih 2017-08-17 854 #undef SET_RATE_ID
56bde846 Ping-Ke Shih 2017-08-17 855 }
56bde846 Ping-Ke Shih 2017-08-17 856
:::::: The code at line 778 was first introduced by commit
:::::: 56bde846304ea05d5f8c8de0e3a42627a7a92be6 staging: r8822be: Add existing rtlwifi and rtl_pci parts for new driver
:::::: TO: Ping-Ke Shih <pkshih@realtek.com>
:::::: CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 51655 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Staging: rtlwifi: Remove NULL pointer dereference
2017-10-11 12:32 ` Shreeya Patel
@ 2017-10-12 2:16 ` Tobin C. Harding
2017-10-13 18:55 ` Shreeya Patel
0 siblings, 1 reply; 6+ messages in thread
From: Tobin C. Harding @ 2017-10-12 2:16 UTC (permalink / raw)
To: Shreeya Patel; +Cc: gregkh, devel, linux-kernel
On Wed, Oct 11, 2017 at 06:02:47PM +0530, Shreeya Patel wrote:
> On Tue, 2017-10-10 at 11:06 +1100, Tobin C. Harding wrote:
> > 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 <shreeya.patel23498@gmail.com>
> > > ---
> > > 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.
>
> Hello,
>
> Thanks for making me understand.
>
> Here is the code after declaration and initialization of sta_entry.
> Will it be good to add a NULL check in this case?
>
> struct rtl_sta_info *sta_entry = NULL;
> u8 ratr_index = SET_RATE_ID(RATR_INX_WIRELESS_MC);
>
> if (sta) {
> sta_entry = (struct rtl_sta_info *)sta->drv_priv;
> ratr_index = sta_entry->ratr_index;
> }
Later in this function the macro SET_RATE_ID() is called, it relies on sta_entry being NULL if it
was not explicitly set.
Here is the macro;
#define SET_RATE_ID(rate_id) \
((rtlpriv->cfg->spec_ver & RTL_SPEC_NEW_RATEID) ? \
rtl_mrate_idx_to_arfr_id(hw, rate_id, \
(sta_entry ? sta_entry->wireless_mode : \
WIRELESS_MODE_G)) : \
rate_id)
> If we are making a pointer point to NULL then what if any other
> variable is already pointing to NULL for some other purpose.
> Instead, removing initialization will be good right?
A pointer does not _point_ to NULL as such. A NULL pointer has a value of all zero bytes. Have you
read (and completed all the exercises) in KnR
https://en.wikipedia.org/wiki/The_C_Programming_Language
It is, in my opinion, one of the best tech books ever written. If you have any holes in your C
knowledge, this is the place to start.
Good luck,
Tobin.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Staging: rtlwifi: Remove NULL pointer dereference
2017-10-12 2:16 ` Tobin C. Harding
@ 2017-10-13 18:55 ` Shreeya Patel
0 siblings, 0 replies; 6+ messages in thread
From: Shreeya Patel @ 2017-10-13 18:55 UTC (permalink / raw)
To: Tobin C. Harding; +Cc: gregkh, devel, linux-kernel
On Thu, 2017-10-12 at 13:16 +1100, Tobin C. Harding wrote:
> On Wed, Oct 11, 2017 at 06:02:47PM +0530, Shreeya Patel wrote:
> >
> > On Tue, 2017-10-10 at 11:06 +1100, Tobin C. Harding wrote:
> > >
> > > 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 <shreeya.patel23498@gmail.com>
> > > > ---
> > > > 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.
> > Hello,
> >
> > Thanks for making me understand.
> >
> > Here is the code after declaration and initialization of
> > sta_entry.
> > Will it be good to add a NULL check in this case?
> >
> > struct rtl_sta_info *sta_entry = NULL;
> > u8 ratr_index = SET_RATE_ID(RATR_INX_WIRELESS_MC);
> >
> > if (sta) {
> > sta_entry = (struct rtl_sta_info *)sta->drv_priv;
> > ratr_index = sta_entry->ratr_index;
> > }
> Later in this function the macro SET_RATE_ID() is called, it relies
> on sta_entry being NULL if it
> was not explicitly set.
>
> Here is the macro;
>
> #define SET_RATE_ID(rate_id) \
> ((rtlpriv->cfg->spec_ver & RTL_SPEC_NEW_RATEID) ? \
> rtl_mrate_idx_to_arfr_id(hw, rate_id, \
> (sta_entry ? sta_entry->wireless_mode :
> \
> WIRELESS_MODE_G)) : \
> rate_id)
>
> >
> > If we are making a pointer point to NULL then what if any other
> > variable is already pointing to NULL for some other purpose.
> > Instead, removing initialization will be good right?
> A pointer does not _point_ to NULL as such. A NULL pointer has a
> value of all zero bytes. Have you
> read (and completed all the exercises) in KnR
>
> https://en.wikipedia.org/wiki/The_C_Programming_Language
>
> It is, in my opinion, one of the best tech books ever written. If you
> have any holes in your C
> knowledge, this is the place to start.
Thank you so much.
I will make sure that I don't make the same mistake again.
>
> Good luck,
> Tobin.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-10-13 18:55 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-09 21:18 [PATCH] Staging: rtlwifi: Remove NULL pointer dereference Shreeya Patel
2017-10-10 0:06 ` Tobin C. Harding
2017-10-11 12:32 ` Shreeya Patel
2017-10-12 2:16 ` Tobin C. Harding
2017-10-13 18:55 ` Shreeya Patel
2017-10-11 19:11 ` kbuild test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.