linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rsi: Properly initialize data in rsi_sdio_ta_reset
@ 2019-05-02 15:15 Nathan Chancellor
  2019-05-02 18:18 ` Nick Desaulniers
  2019-05-23 15:30 ` [PATCH v2 5.2] " Nathan Chancellor
  0 siblings, 2 replies; 11+ messages in thread
From: Nathan Chancellor @ 2019-05-02 15:15 UTC (permalink / raw)
  To: Amitkumar Karwar, Siva Rebbagondla, Kalle Valo
  Cc: linux-wireless, netdev, linux-kernel, clang-built-linux,
	Nick Desaulniers, Nathan Chancellor

When building with -Wuninitialized, Clang warns:

drivers/net/wireless/rsi/rsi_91x_sdio.c:940:43: warning: variable 'data'
is uninitialized when used here [-Wuninitialized]
        put_unaligned_le32(TA_HOLD_THREAD_VALUE, data);
                                                 ^~~~
drivers/net/wireless/rsi/rsi_91x_sdio.c:930:10: note: initialize the
variable 'data' to silence this warning
        u8 *data;
                ^
                 = NULL
1 warning generated.

Using Clang's suggestion of initializing data to NULL wouldn't work out
because data will be dereferenced by put_unaligned_le32. Use kzalloc to
properly initialize data, which matches a couple of other places in this
driver.

Fixes: e5a1ecc97e5f ("rsi: add firmware loading for 9116 device")
Link: https://github.com/ClangBuiltLinux/linux/issues/464
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
 drivers/net/wireless/rsi/rsi_91x_sdio.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio.c b/drivers/net/wireless/rsi/rsi_91x_sdio.c
index f9c67ed473d1..b35728564c7b 100644
--- a/drivers/net/wireless/rsi/rsi_91x_sdio.c
+++ b/drivers/net/wireless/rsi/rsi_91x_sdio.c
@@ -929,11 +929,15 @@ static int rsi_sdio_ta_reset(struct rsi_hw *adapter)
 	u32 addr;
 	u8 *data;
 
+	data = kzalloc(sizeof(u32), GFP_KERNEL);
+	if (!data)
+		return -ENOMEM;
+
 	status = rsi_sdio_master_access_msword(adapter, TA_BASE_ADDR);
 	if (status < 0) {
 		rsi_dbg(ERR_ZONE,
 			"Unable to set ms word to common reg\n");
-		return status;
+		goto err;
 	}
 
 	rsi_dbg(INIT_ZONE, "%s: Bring TA out of reset\n", __func__);
@@ -944,7 +948,7 @@ static int rsi_sdio_ta_reset(struct rsi_hw *adapter)
 						  RSI_9116_REG_SIZE);
 	if (status < 0) {
 		rsi_dbg(ERR_ZONE, "Unable to hold TA threads\n");
-		return status;
+		goto err;
 	}
 
 	put_unaligned_le32(TA_SOFT_RST_CLR, data);
@@ -954,7 +958,7 @@ static int rsi_sdio_ta_reset(struct rsi_hw *adapter)
 						  RSI_9116_REG_SIZE);
 	if (status < 0) {
 		rsi_dbg(ERR_ZONE, "Unable to get TA out of reset\n");
-		return status;
+		goto err;
 	}
 
 	put_unaligned_le32(TA_PC_ZERO, data);
@@ -964,7 +968,8 @@ static int rsi_sdio_ta_reset(struct rsi_hw *adapter)
 						  RSI_9116_REG_SIZE);
 	if (status < 0) {
 		rsi_dbg(ERR_ZONE, "Unable to Reset TA PC value\n");
-		return -EINVAL;
+		status = -EINVAL;
+		goto err;
 	}
 
 	put_unaligned_le32(TA_RELEASE_THREAD_VALUE, data);
@@ -974,17 +979,19 @@ static int rsi_sdio_ta_reset(struct rsi_hw *adapter)
 						  RSI_9116_REG_SIZE);
 	if (status < 0) {
 		rsi_dbg(ERR_ZONE, "Unable to release TA threads\n");
-		return status;
+		goto err;
 	}
 
 	status = rsi_sdio_master_access_msword(adapter, MISC_CFG_BASE_ADDR);
 	if (status < 0) {
 		rsi_dbg(ERR_ZONE, "Unable to set ms word to common reg\n");
-		return status;
+		goto err;
 	}
 	rsi_dbg(INIT_ZONE, "***** TA Reset done *****\n");
 
-	return 0;
+err:
+	kfree(data);
+	return status;
 }
 
 static struct rsi_host_intf_ops sdio_host_intf_ops = {
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] rsi: Properly initialize data in rsi_sdio_ta_reset
  2019-05-02 15:15 [PATCH] rsi: Properly initialize data in rsi_sdio_ta_reset Nathan Chancellor
@ 2019-05-02 18:18 ` Nick Desaulniers
  2019-05-03  3:17   ` Nathan Chancellor
  2019-05-03  4:38   ` Kalle Valo
  2019-05-23 15:30 ` [PATCH v2 5.2] " Nathan Chancellor
  1 sibling, 2 replies; 11+ messages in thread
From: Nick Desaulniers @ 2019-05-02 18:18 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Amitkumar Karwar, Siva Rebbagondla, Kalle Valo, linux-wireless,
	netdev, LKML, clang-built-linux

On Thu, May 2, 2019 at 8:16 AM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> When building with -Wuninitialized, Clang warns:
>
> drivers/net/wireless/rsi/rsi_91x_sdio.c:940:43: warning: variable 'data'
> is uninitialized when used here [-Wuninitialized]
>         put_unaligned_le32(TA_HOLD_THREAD_VALUE, data);
>                                                  ^~~~
> drivers/net/wireless/rsi/rsi_91x_sdio.c:930:10: note: initialize the
> variable 'data' to silence this warning
>         u8 *data;
>                 ^
>                  = NULL
> 1 warning generated.
>
> Using Clang's suggestion of initializing data to NULL wouldn't work out
> because data will be dereferenced by put_unaligned_le32. Use kzalloc to
> properly initialize data, which matches a couple of other places in this
> driver.
>
> Fixes: e5a1ecc97e5f ("rsi: add firmware loading for 9116 device")
> Link: https://github.com/ClangBuiltLinux/linux/issues/464
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
>  drivers/net/wireless/rsi/rsi_91x_sdio.c | 21 ++++++++++++++-------
>  1 file changed, 14 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio.c b/drivers/net/wireless/rsi/rsi_91x_sdio.c
> index f9c67ed473d1..b35728564c7b 100644
> --- a/drivers/net/wireless/rsi/rsi_91x_sdio.c
> +++ b/drivers/net/wireless/rsi/rsi_91x_sdio.c
> @@ -929,11 +929,15 @@ static int rsi_sdio_ta_reset(struct rsi_hw *adapter)
>         u32 addr;
>         u8 *data;
>
> +       data = kzalloc(sizeof(u32), GFP_KERNEL);

Something fishy is going on here.  We allocate 4 B but declare data as
a u8* (pointer to individual bytes)?  In general, dynamically
allocating that few bytes is a code smell; either you meant to just
use the stack, or this memory's lifetime extends past the lifetime of
this stackframe, at which point you probably just meant to stack
allocate space in a higher parent frame and pass this preallocated
memory down to the child frame to get filled in.

Reading through this code, I don't think that the memory is meant to
outlive the stack frame.  Is there a reason why we can't just declare
data as:

u8 data [4];

then use ARRAY_SIZE(data) or RSI_9116_REG_SIZE in rsi_reset_chip(),
getting rid of the kzalloc/kfree?

(Sorry, I hate when a simple fixup becomes a "hey let's rewrite all
this code" thus becoming "that guy.")
-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] rsi: Properly initialize data in rsi_sdio_ta_reset
  2019-05-02 18:18 ` Nick Desaulniers
@ 2019-05-03  3:17   ` Nathan Chancellor
  2019-05-23  1:54     ` Nathan Chancellor
  2019-05-03  4:38   ` Kalle Valo
  1 sibling, 1 reply; 11+ messages in thread
From: Nathan Chancellor @ 2019-05-03  3:17 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Amitkumar Karwar, Siva Rebbagondla, Kalle Valo, linux-wireless,
	netdev, LKML, clang-built-linux

On Thu, May 02, 2019 at 11:18:01AM -0700, Nick Desaulniers wrote:
> On Thu, May 2, 2019 at 8:16 AM Nathan Chancellor
> <natechancellor@gmail.com> wrote:
> >
> > When building with -Wuninitialized, Clang warns:
> >
> > drivers/net/wireless/rsi/rsi_91x_sdio.c:940:43: warning: variable 'data'
> > is uninitialized when used here [-Wuninitialized]
> >         put_unaligned_le32(TA_HOLD_THREAD_VALUE, data);
> >                                                  ^~~~
> > drivers/net/wireless/rsi/rsi_91x_sdio.c:930:10: note: initialize the
> > variable 'data' to silence this warning
> >         u8 *data;
> >                 ^
> >                  = NULL
> > 1 warning generated.
> >
> > Using Clang's suggestion of initializing data to NULL wouldn't work out
> > because data will be dereferenced by put_unaligned_le32. Use kzalloc to
> > properly initialize data, which matches a couple of other places in this
> > driver.
> >
> > Fixes: e5a1ecc97e5f ("rsi: add firmware loading for 9116 device")
> > Link: https://github.com/ClangBuiltLinux/linux/issues/464
> > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > ---
> >  drivers/net/wireless/rsi/rsi_91x_sdio.c | 21 ++++++++++++++-------
> >  1 file changed, 14 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio.c b/drivers/net/wireless/rsi/rsi_91x_sdio.c
> > index f9c67ed473d1..b35728564c7b 100644
> > --- a/drivers/net/wireless/rsi/rsi_91x_sdio.c
> > +++ b/drivers/net/wireless/rsi/rsi_91x_sdio.c
> > @@ -929,11 +929,15 @@ static int rsi_sdio_ta_reset(struct rsi_hw *adapter)
> >         u32 addr;
> >         u8 *data;
> >
> > +       data = kzalloc(sizeof(u32), GFP_KERNEL);
> 
> Something fishy is going on here.  We allocate 4 B but declare data as
> a u8* (pointer to individual bytes)?  In general, dynamically
> allocating that few bytes is a code smell; either you meant to just
> use the stack, or this memory's lifetime extends past the lifetime of
> this stackframe, at which point you probably just meant to stack
> allocate space in a higher parent frame and pass this preallocated
> memory down to the child frame to get filled in.
> 
> Reading through this code, I don't think that the memory is meant to
> outlive the stack frame.  Is there a reason why we can't just declare
> data as:
> 
> u8 data [4];

data was __le32 in rsi_reset_chip() before commit f700546682a6 ("rsi:
fix nommu_map_sg overflow kernel panic").

I wonder if this would be okay for this function:

-------------------------------------------------

diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio.c b/drivers/net/wireless/rsi/rsi_91x_sdio.c
index f9c67ed473d1..0330c50ab99c 100644
--- a/drivers/net/wireless/rsi/rsi_91x_sdio.c
+++ b/drivers/net/wireless/rsi/rsi_91x_sdio.c
@@ -927,7 +927,7 @@ static int rsi_sdio_ta_reset(struct rsi_hw *adapter)
 {
        int status;
        u32 addr;
-       u8 *data;
+       u8 data;
 
        status = rsi_sdio_master_access_msword(adapter, TA_BASE_ADDR);
        if (status < 0) {
@@ -937,7 +937,7 @@ static int rsi_sdio_ta_reset(struct rsi_hw *adapter)
        }
 
        rsi_dbg(INIT_ZONE, "%s: Bring TA out of reset\n", __func__);
-       put_unaligned_le32(TA_HOLD_THREAD_VALUE, data);
+       put_unaligned_le32(TA_HOLD_THREAD_VALUE, &data);
        addr = TA_HOLD_THREAD_REG | RSI_SD_REQUEST_MASTER;
        status = rsi_sdio_write_register_multiple(adapter, addr,
                                                  (u8 *)&data,
@@ -947,7 +947,7 @@ static int rsi_sdio_ta_reset(struct rsi_hw *adapter)
                return status;
        }
 
-       put_unaligned_le32(TA_SOFT_RST_CLR, data);
+       put_unaligned_le32(TA_SOFT_RST_CLR, &data);
        addr = TA_SOFT_RESET_REG | RSI_SD_REQUEST_MASTER;
        status = rsi_sdio_write_register_multiple(adapter, addr,
                                                  (u8 *)&data,
@@ -957,7 +957,7 @@ static int rsi_sdio_ta_reset(struct rsi_hw *adapter)
                return status;
        }
 
-       put_unaligned_le32(TA_PC_ZERO, data);
+       put_unaligned_le32(TA_PC_ZERO, &data);
        addr = TA_TH0_PC_REG | RSI_SD_REQUEST_MASTER;
        status = rsi_sdio_write_register_multiple(adapter, addr,
                                                  (u8 *)&data,
@@ -967,7 +967,7 @@ static int rsi_sdio_ta_reset(struct rsi_hw *adapter)
                return -EINVAL;
        }
 
-       put_unaligned_le32(TA_RELEASE_THREAD_VALUE, data);
+       put_unaligned_le32(TA_RELEASE_THREAD_VALUE, &data);
        addr = TA_RELEASE_THREAD_REG | RSI_SD_REQUEST_MASTER;
        status = rsi_sdio_write_register_multiple(adapter, addr,
                                                  (u8 *)&data,


> 
> then use ARRAY_SIZE(data) or RSI_9116_REG_SIZE in rsi_reset_chip(),
> getting rid of the kzalloc/kfree?
> 
> (Sorry, I hate when a simple fixup becomes a "hey let's rewrite all
> this code" thus becoming "that guy.")

If we aren't actually improving the code, then why bother? :)

Thank you for the review!
Nathan

> -- 
> Thanks,
> ~Nick Desaulniers

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] rsi: Properly initialize data in rsi_sdio_ta_reset
  2019-05-02 18:18 ` Nick Desaulniers
  2019-05-03  3:17   ` Nathan Chancellor
@ 2019-05-03  4:38   ` Kalle Valo
  2019-05-06 20:51     ` Nathan Chancellor
  1 sibling, 1 reply; 11+ messages in thread
From: Kalle Valo @ 2019-05-03  4:38 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Nathan Chancellor, Amitkumar Karwar, Siva Rebbagondla,
	linux-wireless, netdev, LKML, clang-built-linux

Nick Desaulniers <ndesaulniers@google.com> writes:

> On Thu, May 2, 2019 at 8:16 AM Nathan Chancellor
> <natechancellor@gmail.com> wrote:
>>
>> When building with -Wuninitialized, Clang warns:
>>
>> drivers/net/wireless/rsi/rsi_91x_sdio.c:940:43: warning: variable 'data'
>> is uninitialized when used here [-Wuninitialized]
>>         put_unaligned_le32(TA_HOLD_THREAD_VALUE, data);
>>                                                  ^~~~
>> drivers/net/wireless/rsi/rsi_91x_sdio.c:930:10: note: initialize the
>> variable 'data' to silence this warning
>>         u8 *data;
>>                 ^
>>                  = NULL
>> 1 warning generated.
>>
>> Using Clang's suggestion of initializing data to NULL wouldn't work out
>> because data will be dereferenced by put_unaligned_le32. Use kzalloc to
>> properly initialize data, which matches a couple of other places in this
>> driver.
>>
>> Fixes: e5a1ecc97e5f ("rsi: add firmware loading for 9116 device")
>> Link: https://github.com/ClangBuiltLinux/linux/issues/464
>> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
>> ---
>>  drivers/net/wireless/rsi/rsi_91x_sdio.c | 21 ++++++++++++++-------
>>  1 file changed, 14 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio.c b/drivers/net/wireless/rsi/rsi_91x_sdio.c
>> index f9c67ed473d1..b35728564c7b 100644
>> --- a/drivers/net/wireless/rsi/rsi_91x_sdio.c
>> +++ b/drivers/net/wireless/rsi/rsi_91x_sdio.c
>> @@ -929,11 +929,15 @@ static int rsi_sdio_ta_reset(struct rsi_hw *adapter)
>>         u32 addr;
>>         u8 *data;
>>
>> +       data = kzalloc(sizeof(u32), GFP_KERNEL);
>
> Something fishy is going on here.  We allocate 4 B but declare data as
> a u8* (pointer to individual bytes)?  In general, dynamically
> allocating that few bytes is a code smell; either you meant to just
> use the stack, or this memory's lifetime extends past the lifetime of
> this stackframe, at which point you probably just meant to stack
> allocate space in a higher parent frame and pass this preallocated
> memory down to the child frame to get filled in.
>
> Reading through this code, I don't think that the memory is meant to
> outlive the stack frame.  Is there a reason why we can't just declare
> data as:
>
> u8 data [4];
>
> then use ARRAY_SIZE(data) or RSI_9116_REG_SIZE in rsi_reset_chip(),
> getting rid of the kzalloc/kfree?

I haven't checked the details but AFAIK stack variables are not supposed
to be used with DMA. So in that case I think it's ok alloc four bytes,
unless the DMA rules have changed of course. But I didn't check if rsi
is using DMA here, just a general comment.

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] rsi: Properly initialize data in rsi_sdio_ta_reset
  2019-05-03  4:38   ` Kalle Valo
@ 2019-05-06 20:51     ` Nathan Chancellor
  0 siblings, 0 replies; 11+ messages in thread
From: Nathan Chancellor @ 2019-05-06 20:51 UTC (permalink / raw)
  To: Kalle Valo
  Cc: Nick Desaulniers, Amitkumar Karwar, Siva Rebbagondla,
	linux-wireless, netdev, LKML, clang-built-linux

On Fri, May 03, 2019 at 07:38:52AM +0300, Kalle Valo wrote:
> Nick Desaulniers <ndesaulniers@google.com> writes:
> 
> > On Thu, May 2, 2019 at 8:16 AM Nathan Chancellor
> > <natechancellor@gmail.com> wrote:
> >>
> >> When building with -Wuninitialized, Clang warns:
> >>
> >> drivers/net/wireless/rsi/rsi_91x_sdio.c:940:43: warning: variable 'data'
> >> is uninitialized when used here [-Wuninitialized]
> >>         put_unaligned_le32(TA_HOLD_THREAD_VALUE, data);
> >>                                                  ^~~~
> >> drivers/net/wireless/rsi/rsi_91x_sdio.c:930:10: note: initialize the
> >> variable 'data' to silence this warning
> >>         u8 *data;
> >>                 ^
> >>                  = NULL
> >> 1 warning generated.
> >>
> >> Using Clang's suggestion of initializing data to NULL wouldn't work out
> >> because data will be dereferenced by put_unaligned_le32. Use kzalloc to
> >> properly initialize data, which matches a couple of other places in this
> >> driver.
> >>
> >> Fixes: e5a1ecc97e5f ("rsi: add firmware loading for 9116 device")
> >> Link: https://github.com/ClangBuiltLinux/linux/issues/464
> >> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> >> ---
> >>  drivers/net/wireless/rsi/rsi_91x_sdio.c | 21 ++++++++++++++-------
> >>  1 file changed, 14 insertions(+), 7 deletions(-)
> >>
> >> diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio.c b/drivers/net/wireless/rsi/rsi_91x_sdio.c
> >> index f9c67ed473d1..b35728564c7b 100644
> >> --- a/drivers/net/wireless/rsi/rsi_91x_sdio.c
> >> +++ b/drivers/net/wireless/rsi/rsi_91x_sdio.c
> >> @@ -929,11 +929,15 @@ static int rsi_sdio_ta_reset(struct rsi_hw *adapter)
> >>         u32 addr;
> >>         u8 *data;
> >>
> >> +       data = kzalloc(sizeof(u32), GFP_KERNEL);
> >
> > Something fishy is going on here.  We allocate 4 B but declare data as
> > a u8* (pointer to individual bytes)?  In general, dynamically
> > allocating that few bytes is a code smell; either you meant to just
> > use the stack, or this memory's lifetime extends past the lifetime of
> > this stackframe, at which point you probably just meant to stack
> > allocate space in a higher parent frame and pass this preallocated
> > memory down to the child frame to get filled in.
> >
> > Reading through this code, I don't think that the memory is meant to
> > outlive the stack frame.  Is there a reason why we can't just declare
> > data as:
> >
> > u8 data [4];
> >
> > then use ARRAY_SIZE(data) or RSI_9116_REG_SIZE in rsi_reset_chip(),
> > getting rid of the kzalloc/kfree?
> 
> I haven't checked the details but AFAIK stack variables are not supposed
> to be used with DMA. So in that case I think it's ok alloc four bytes,
> unless the DMA rules have changed of course. But I didn't check if rsi
> is using DMA here, just a general comment.
> 
> -- 
> Kalle Valo

I don't think it is using the DMA API but it might be the same thing for
SDIO. If passing that around on the stack is okay, great but we don't
want what commit f700546682a6 ("rsi: fix nommu_map_sg overflow kernel
panic") fixes to happen here.

I can't answer that for sure though since I am not at all familiar with
this driver or the SDIO APIs.

Cheers,
Nathan

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] rsi: Properly initialize data in rsi_sdio_ta_reset
  2019-05-03  3:17   ` Nathan Chancellor
@ 2019-05-23  1:54     ` Nathan Chancellor
  2019-05-23  8:51       ` Arnd Bergmann
  2019-05-23  8:52       ` Kalle Valo
  0 siblings, 2 replies; 11+ messages in thread
From: Nathan Chancellor @ 2019-05-23  1:54 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Amitkumar Karwar, Siva Rebbagondla, Kalle Valo, linux-wireless,
	netdev, LKML, clang-built-linux

On Thu, May 02, 2019 at 08:17:18PM -0700, Nathan Chancellor wrote:
> On Thu, May 02, 2019 at 11:18:01AM -0700, Nick Desaulniers wrote:
> > On Thu, May 2, 2019 at 8:16 AM Nathan Chancellor
> > <natechancellor@gmail.com> wrote:
> > >
> > > When building with -Wuninitialized, Clang warns:
> > >
> > > drivers/net/wireless/rsi/rsi_91x_sdio.c:940:43: warning: variable 'data'
> > > is uninitialized when used here [-Wuninitialized]
> > >         put_unaligned_le32(TA_HOLD_THREAD_VALUE, data);
> > >                                                  ^~~~
> > > drivers/net/wireless/rsi/rsi_91x_sdio.c:930:10: note: initialize the
> > > variable 'data' to silence this warning
> > >         u8 *data;
> > >                 ^
> > >                  = NULL
> > > 1 warning generated.
> > >
> > > Using Clang's suggestion of initializing data to NULL wouldn't work out
> > > because data will be dereferenced by put_unaligned_le32. Use kzalloc to
> > > properly initialize data, which matches a couple of other places in this
> > > driver.
> > >
> > > Fixes: e5a1ecc97e5f ("rsi: add firmware loading for 9116 device")
> > > Link: https://github.com/ClangBuiltLinux/linux/issues/464
> > > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > > ---
> > >  drivers/net/wireless/rsi/rsi_91x_sdio.c | 21 ++++++++++++++-------
> > >  1 file changed, 14 insertions(+), 7 deletions(-)
> > >
> > > diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio.c b/drivers/net/wireless/rsi/rsi_91x_sdio.c
> > > index f9c67ed473d1..b35728564c7b 100644
> > > --- a/drivers/net/wireless/rsi/rsi_91x_sdio.c
> > > +++ b/drivers/net/wireless/rsi/rsi_91x_sdio.c
> > > @@ -929,11 +929,15 @@ static int rsi_sdio_ta_reset(struct rsi_hw *adapter)
> > >         u32 addr;
> > >         u8 *data;
> > >
> > > +       data = kzalloc(sizeof(u32), GFP_KERNEL);
> > 
> > Something fishy is going on here.  We allocate 4 B but declare data as
> > a u8* (pointer to individual bytes)?  In general, dynamically
> > allocating that few bytes is a code smell; either you meant to just
> > use the stack, or this memory's lifetime extends past the lifetime of
> > this stackframe, at which point you probably just meant to stack
> > allocate space in a higher parent frame and pass this preallocated
> > memory down to the child frame to get filled in.
> > 
> > Reading through this code, I don't think that the memory is meant to
> > outlive the stack frame.  Is there a reason why we can't just declare
> > data as:
> > 
> > u8 data [4];
> 
> data was __le32 in rsi_reset_chip() before commit f700546682a6 ("rsi:
> fix nommu_map_sg overflow kernel panic").
> 
> I wonder if this would be okay for this function:
> 
> -------------------------------------------------
> 
> diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio.c b/drivers/net/wireless/rsi/rsi_91x_sdio.c
> index f9c67ed473d1..0330c50ab99c 100644
> --- a/drivers/net/wireless/rsi/rsi_91x_sdio.c
> +++ b/drivers/net/wireless/rsi/rsi_91x_sdio.c
> @@ -927,7 +927,7 @@ static int rsi_sdio_ta_reset(struct rsi_hw *adapter)
>  {
>         int status;
>         u32 addr;
> -       u8 *data;
> +       u8 data;
>  
>         status = rsi_sdio_master_access_msword(adapter, TA_BASE_ADDR);
>         if (status < 0) {
> @@ -937,7 +937,7 @@ static int rsi_sdio_ta_reset(struct rsi_hw *adapter)
>         }
>  
>         rsi_dbg(INIT_ZONE, "%s: Bring TA out of reset\n", __func__);
> -       put_unaligned_le32(TA_HOLD_THREAD_VALUE, data);
> +       put_unaligned_le32(TA_HOLD_THREAD_VALUE, &data);
>         addr = TA_HOLD_THREAD_REG | RSI_SD_REQUEST_MASTER;
>         status = rsi_sdio_write_register_multiple(adapter, addr,
>                                                   (u8 *)&data,
> @@ -947,7 +947,7 @@ static int rsi_sdio_ta_reset(struct rsi_hw *adapter)
>                 return status;
>         }
>  
> -       put_unaligned_le32(TA_SOFT_RST_CLR, data);
> +       put_unaligned_le32(TA_SOFT_RST_CLR, &data);
>         addr = TA_SOFT_RESET_REG | RSI_SD_REQUEST_MASTER;
>         status = rsi_sdio_write_register_multiple(adapter, addr,
>                                                   (u8 *)&data,
> @@ -957,7 +957,7 @@ static int rsi_sdio_ta_reset(struct rsi_hw *adapter)
>                 return status;
>         }
>  
> -       put_unaligned_le32(TA_PC_ZERO, data);
> +       put_unaligned_le32(TA_PC_ZERO, &data);
>         addr = TA_TH0_PC_REG | RSI_SD_REQUEST_MASTER;
>         status = rsi_sdio_write_register_multiple(adapter, addr,
>                                                   (u8 *)&data,
> @@ -967,7 +967,7 @@ static int rsi_sdio_ta_reset(struct rsi_hw *adapter)
>                 return -EINVAL;
>         }
>  
> -       put_unaligned_le32(TA_RELEASE_THREAD_VALUE, data);
> +       put_unaligned_le32(TA_RELEASE_THREAD_VALUE, &data);
>         addr = TA_RELEASE_THREAD_REG | RSI_SD_REQUEST_MASTER;
>         status = rsi_sdio_write_register_multiple(adapter, addr,
>                                                   (u8 *)&data,
> 
> 
> > 
> > then use ARRAY_SIZE(data) or RSI_9116_REG_SIZE in rsi_reset_chip(),
> > getting rid of the kzalloc/kfree?
> > 
> > (Sorry, I hate when a simple fixup becomes a "hey let's rewrite all
> > this code" thus becoming "that guy.")
> 
> If we aren't actually improving the code, then why bother? :)
> 
> Thank you for the review!
> Nathan
> 
> > -- 
> > Thanks,
> > ~Nick Desaulniers

Hi all,

Did any of the maintainers have any comments on what the correct
solution is here to resolve this warning? It is one of the few left
before we can turn on -Wuninitialized for the whole kernel.

Thanks,
Nathan

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] rsi: Properly initialize data in rsi_sdio_ta_reset
  2019-05-23  1:54     ` Nathan Chancellor
@ 2019-05-23  8:51       ` Arnd Bergmann
  2019-05-23  8:56         ` Kalle Valo
  2019-05-23  8:52       ` Kalle Valo
  1 sibling, 1 reply; 11+ messages in thread
From: Arnd Bergmann @ 2019-05-23  8:51 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Nick Desaulniers, Amitkumar Karwar, Siva Rebbagondla, Kalle Valo,
	linux-wireless, Networking, LKML, clang-built-linux

On Thu, May 23, 2019 at 3:54 AM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> On Thu, May 02, 2019 at 08:17:18PM -0700, Nathan Chancellor wrote:
> > On Thu, May 02, 2019 at 11:18:01AM -0700, Nick Desaulniers wrote:
> > > On Thu, May 2, 2019 at 8:16 AM Nathan Chancellor
> > > u8 data [4];
> >
> > data was __le32 in rsi_reset_chip() before commit f700546682a6 ("rsi:
> > fix nommu_map_sg overflow kernel panic").
> >
> > I wonder if this would be okay for this function:
> >
> > -------------------------------------------------
> >
> > diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio.c b/drivers/net/wireless/rsi/rsi_91x_sdio.c
> > index f9c67ed473d1..0330c50ab99c 100644
> > --- a/drivers/net/wireless/rsi/rsi_91x_sdio.c
> > +++ b/drivers/net/wireless/rsi/rsi_91x_sdio.c
> > @@ -927,7 +927,7 @@ static int rsi_sdio_ta_reset(struct rsi_hw *adapter)
> >  {
> >         int status;
> >         u32 addr;
> > -       u8 *data;
> > +       u8 data;
> >
> >         status = rsi_sdio_master_access_msword(adapter, TA_BASE_ADDR);
> >         if (status < 0) {
> > @@ -937,7 +937,7 @@ static int rsi_sdio_ta_reset(struct rsi_hw *adapter)
> >         }
> >
> >         rsi_dbg(INIT_ZONE, "%s: Bring TA out of reset\n", __func__);
> > -       put_unaligned_le32(TA_HOLD_THREAD_VALUE, data);
> > +       put_unaligned_le32(TA_HOLD_THREAD_VALUE, &data);
> >         addr = TA_HOLD_THREAD_REG | RSI_SD_REQUEST_MASTER;
> >         status = rsi_sdio_write_register_multiple(adapter, addr,
> >                                                   (u8 *)&data,

This is clearly not ok, as put_unaligned_le32() stores four bytes, and
the local variable is only one byte!

Also, sdio does use DMA for transfers, so the variable has to be
dynamically allocated. I think your original patch was correct.
The only change I'd possibly make would be to use
RSI_9116_REG_SIZE instead of sizeof(u32).

> Did any of the maintainers have any comments on what the correct
> solution is here to resolve this warning? It is one of the few left
> before we can turn on -Wuninitialized for the whole kernel.

I would argue that this should not stop us from turning it on, as the
warning is for a clear bug in the code that absolutely needs to be
fixed, rather than a false-positive.

       Arnd

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] rsi: Properly initialize data in rsi_sdio_ta_reset
  2019-05-23  1:54     ` Nathan Chancellor
  2019-05-23  8:51       ` Arnd Bergmann
@ 2019-05-23  8:52       ` Kalle Valo
  1 sibling, 0 replies; 11+ messages in thread
From: Kalle Valo @ 2019-05-23  8:52 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Nick Desaulniers, Amitkumar Karwar, Siva Rebbagondla,
	linux-wireless, netdev, LKML, clang-built-linux

Nathan Chancellor <natechancellor@gmail.com> writes:

> On Thu, May 02, 2019 at 08:17:18PM -0700, Nathan Chancellor wrote:
>> On Thu, May 02, 2019 at 11:18:01AM -0700, Nick Desaulniers wrote:
>> > On Thu, May 2, 2019 at 8:16 AM Nathan Chancellor
>> > <natechancellor@gmail.com> wrote:
>> > >
>> > > When building with -Wuninitialized, Clang warns:
>> > >
>> > > drivers/net/wireless/rsi/rsi_91x_sdio.c:940:43: warning: variable 'data'
>> > > is uninitialized when used here [-Wuninitialized]
>> > >         put_unaligned_le32(TA_HOLD_THREAD_VALUE, data);
>> > >                                                  ^~~~
>> > > drivers/net/wireless/rsi/rsi_91x_sdio.c:930:10: note: initialize the
>> > > variable 'data' to silence this warning
>> > >         u8 *data;
>> > >                 ^
>> > >                  = NULL
>> > > 1 warning generated.
>> > >
>> > > Using Clang's suggestion of initializing data to NULL wouldn't work out
>> > > because data will be dereferenced by put_unaligned_le32. Use kzalloc to
>> > > properly initialize data, which matches a couple of other places in this
>> > > driver.
>> > >
>> > > Fixes: e5a1ecc97e5f ("rsi: add firmware loading for 9116 device")
>> > > Link: https://github.com/ClangBuiltLinux/linux/issues/464
>> > > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
>> > > ---
>> > >  drivers/net/wireless/rsi/rsi_91x_sdio.c | 21 ++++++++++++++-------
>> > >  1 file changed, 14 insertions(+), 7 deletions(-)
>> > >
>> > > diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio.c b/drivers/net/wireless/rsi/rsi_91x_sdio.c
>> > > index f9c67ed473d1..b35728564c7b 100644
>> > > --- a/drivers/net/wireless/rsi/rsi_91x_sdio.c
>> > > +++ b/drivers/net/wireless/rsi/rsi_91x_sdio.c
>> > > @@ -929,11 +929,15 @@ static int rsi_sdio_ta_reset(struct rsi_hw *adapter)
>> > >         u32 addr;
>> > >         u8 *data;
>> > >
>> > > +       data = kzalloc(sizeof(u32), GFP_KERNEL);
>> > 
>> > Something fishy is going on here.  We allocate 4 B but declare data as
>> > a u8* (pointer to individual bytes)?  In general, dynamically
>> > allocating that few bytes is a code smell; either you meant to just
>> > use the stack, or this memory's lifetime extends past the lifetime of
>> > this stackframe, at which point you probably just meant to stack
>> > allocate space in a higher parent frame and pass this preallocated
>> > memory down to the child frame to get filled in.
>> > 
>> > Reading through this code, I don't think that the memory is meant to
>> > outlive the stack frame.  Is there a reason why we can't just declare
>> > data as:
>> > 
>> > u8 data [4];
>> 
>> data was __le32 in rsi_reset_chip() before commit f700546682a6 ("rsi:
>> fix nommu_map_sg overflow kernel panic").
>> 
>> I wonder if this would be okay for this function:
>> 
>> -------------------------------------------------
>> 
>> diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio.c b/drivers/net/wireless/rsi/rsi_91x_sdio.c
>> index f9c67ed473d1..0330c50ab99c 100644
>> --- a/drivers/net/wireless/rsi/rsi_91x_sdio.c
>> +++ b/drivers/net/wireless/rsi/rsi_91x_sdio.c
>> @@ -927,7 +927,7 @@ static int rsi_sdio_ta_reset(struct rsi_hw *adapter)
>>  {
>>         int status;
>>         u32 addr;
>> -       u8 *data;
>> +       u8 data;
>>  
>>         status = rsi_sdio_master_access_msword(adapter, TA_BASE_ADDR);
>>         if (status < 0) {
>> @@ -937,7 +937,7 @@ static int rsi_sdio_ta_reset(struct rsi_hw *adapter)
>>         }
>>  
>>         rsi_dbg(INIT_ZONE, "%s: Bring TA out of reset\n", __func__);
>> -       put_unaligned_le32(TA_HOLD_THREAD_VALUE, data);
>> +       put_unaligned_le32(TA_HOLD_THREAD_VALUE, &data);
>>         addr = TA_HOLD_THREAD_REG | RSI_SD_REQUEST_MASTER;
>>         status = rsi_sdio_write_register_multiple(adapter, addr,
>>                                                   (u8 *)&data,
>> @@ -947,7 +947,7 @@ static int rsi_sdio_ta_reset(struct rsi_hw *adapter)
>>                 return status;
>>         }
>>  
>> -       put_unaligned_le32(TA_SOFT_RST_CLR, data);
>> +       put_unaligned_le32(TA_SOFT_RST_CLR, &data);
>>         addr = TA_SOFT_RESET_REG | RSI_SD_REQUEST_MASTER;
>>         status = rsi_sdio_write_register_multiple(adapter, addr,
>>                                                   (u8 *)&data,
>> @@ -957,7 +957,7 @@ static int rsi_sdio_ta_reset(struct rsi_hw *adapter)
>>                 return status;
>>         }
>>  
>> -       put_unaligned_le32(TA_PC_ZERO, data);
>> +       put_unaligned_le32(TA_PC_ZERO, &data);
>>         addr = TA_TH0_PC_REG | RSI_SD_REQUEST_MASTER;
>>         status = rsi_sdio_write_register_multiple(adapter, addr,
>>                                                   (u8 *)&data,
>> @@ -967,7 +967,7 @@ static int rsi_sdio_ta_reset(struct rsi_hw *adapter)
>>                 return -EINVAL;
>>         }
>>  
>> -       put_unaligned_le32(TA_RELEASE_THREAD_VALUE, data);
>> +       put_unaligned_le32(TA_RELEASE_THREAD_VALUE, &data);
>>         addr = TA_RELEASE_THREAD_REG | RSI_SD_REQUEST_MASTER;
>>         status = rsi_sdio_write_register_multiple(adapter, addr,
>>                                                   (u8 *)&data,
>> 
>> 
>> > 
>> > then use ARRAY_SIZE(data) or RSI_9116_REG_SIZE in rsi_reset_chip(),
>> > getting rid of the kzalloc/kfree?
>> > 
>> > (Sorry, I hate when a simple fixup becomes a "hey let's rewrite all
>> > this code" thus becoming "that guy.")
>> 
>> If we aren't actually improving the code, then why bother? :)
>> 
>> Thank you for the review!
>
> Did any of the maintainers have any comments on what the correct
> solution is here to resolve this warning? It is one of the few left
> before we can turn on -Wuninitialized for the whole kernel.

I don't have any strong opinion, but as the commit log says that
kzalloc() is also used in similar cases in the same driver I would happy
to take this patch as is.

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] rsi: Properly initialize data in rsi_sdio_ta_reset
  2019-05-23  8:51       ` Arnd Bergmann
@ 2019-05-23  8:56         ` Kalle Valo
  0 siblings, 0 replies; 11+ messages in thread
From: Kalle Valo @ 2019-05-23  8:56 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Nathan Chancellor, Nick Desaulniers, Amitkumar Karwar,
	Siva Rebbagondla, linux-wireless, Networking, LKML,
	clang-built-linux

Arnd Bergmann <arnd@arndb.de> writes:

>> > @@ -937,7 +937,7 @@ static int rsi_sdio_ta_reset(struct rsi_hw *adapter)
>> >         }
>> >
>> >         rsi_dbg(INIT_ZONE, "%s: Bring TA out of reset\n", __func__);
>> > -       put_unaligned_le32(TA_HOLD_THREAD_VALUE, data);
>> > +       put_unaligned_le32(TA_HOLD_THREAD_VALUE, &data);
>> >         addr = TA_HOLD_THREAD_REG | RSI_SD_REQUEST_MASTER;
>> >         status = rsi_sdio_write_register_multiple(adapter, addr,
>> >                                                   (u8 *)&data,
>
> This is clearly not ok, as put_unaligned_le32() stores four bytes, and
> the local variable is only one byte!
>
> Also, sdio does use DMA for transfers, so the variable has to be
> dynamically allocated. I think your original patch was correct.
> The only change I'd possibly make would be to use
> RSI_9116_REG_SIZE instead of sizeof(u32).

Good point. Nathan please fix this and submit v2.

>> Did any of the maintainers have any comments on what the correct
>> solution is here to resolve this warning? It is one of the few left
>> before we can turn on -Wuninitialized for the whole kernel.
>
> I would argue that this should not stop us from turning it on, as the
> warning is for a clear bug in the code that absolutely needs to be
> fixed, rather than a false-positive.

I can queue v2 for v5.2, just remind me by adding "[PATCH v2 5.2]" to
the subject.

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 5.2] rsi: Properly initialize data in rsi_sdio_ta_reset
  2019-05-02 15:15 [PATCH] rsi: Properly initialize data in rsi_sdio_ta_reset Nathan Chancellor
  2019-05-02 18:18 ` Nick Desaulniers
@ 2019-05-23 15:30 ` Nathan Chancellor
  2019-05-28 11:33   ` Kalle Valo
  1 sibling, 1 reply; 11+ messages in thread
From: Nathan Chancellor @ 2019-05-23 15:30 UTC (permalink / raw)
  To: Amitkumar Karwar, Siva Rebbagondla, Kalle Valo
  Cc: linux-wireless, netdev, linux-kernel, Arnd Bergmann,
	Nick Desaulniers, clang-built-linux, Nathan Chancellor

When building with -Wuninitialized, Clang warns:

drivers/net/wireless/rsi/rsi_91x_sdio.c:940:43: warning: variable 'data'
is uninitialized when used here [-Wuninitialized]
        put_unaligned_le32(TA_HOLD_THREAD_VALUE, data);
                                                 ^~~~
drivers/net/wireless/rsi/rsi_91x_sdio.c:930:10: note: initialize the
variable 'data' to silence this warning
        u8 *data;
                ^
                 = NULL
1 warning generated.

Using Clang's suggestion of initializing data to NULL wouldn't work out
because data will be dereferenced by put_unaligned_le32. Use kzalloc to
properly initialize data, which matches a couple of other places in this
driver.

Fixes: e5a1ecc97e5f ("rsi: add firmware loading for 9116 device")
Link: https://github.com/ClangBuiltLinux/linux/issues/464
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---

v1 -> v2:

* Use RSI_9116_REG_SIZE instead of sizeof(u32) for kzalloc thanks to
  review from Arnd.

 drivers/net/wireless/rsi/rsi_91x_sdio.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio.c b/drivers/net/wireless/rsi/rsi_91x_sdio.c
index f9c67ed473d1..b42cd50b837e 100644
--- a/drivers/net/wireless/rsi/rsi_91x_sdio.c
+++ b/drivers/net/wireless/rsi/rsi_91x_sdio.c
@@ -929,11 +929,15 @@ static int rsi_sdio_ta_reset(struct rsi_hw *adapter)
 	u32 addr;
 	u8 *data;
 
+	data = kzalloc(RSI_9116_REG_SIZE, GFP_KERNEL);
+	if (!data)
+		return -ENOMEM;
+
 	status = rsi_sdio_master_access_msword(adapter, TA_BASE_ADDR);
 	if (status < 0) {
 		rsi_dbg(ERR_ZONE,
 			"Unable to set ms word to common reg\n");
-		return status;
+		goto err;
 	}
 
 	rsi_dbg(INIT_ZONE, "%s: Bring TA out of reset\n", __func__);
@@ -944,7 +948,7 @@ static int rsi_sdio_ta_reset(struct rsi_hw *adapter)
 						  RSI_9116_REG_SIZE);
 	if (status < 0) {
 		rsi_dbg(ERR_ZONE, "Unable to hold TA threads\n");
-		return status;
+		goto err;
 	}
 
 	put_unaligned_le32(TA_SOFT_RST_CLR, data);
@@ -954,7 +958,7 @@ static int rsi_sdio_ta_reset(struct rsi_hw *adapter)
 						  RSI_9116_REG_SIZE);
 	if (status < 0) {
 		rsi_dbg(ERR_ZONE, "Unable to get TA out of reset\n");
-		return status;
+		goto err;
 	}
 
 	put_unaligned_le32(TA_PC_ZERO, data);
@@ -964,7 +968,8 @@ static int rsi_sdio_ta_reset(struct rsi_hw *adapter)
 						  RSI_9116_REG_SIZE);
 	if (status < 0) {
 		rsi_dbg(ERR_ZONE, "Unable to Reset TA PC value\n");
-		return -EINVAL;
+		status = -EINVAL;
+		goto err;
 	}
 
 	put_unaligned_le32(TA_RELEASE_THREAD_VALUE, data);
@@ -974,17 +979,19 @@ static int rsi_sdio_ta_reset(struct rsi_hw *adapter)
 						  RSI_9116_REG_SIZE);
 	if (status < 0) {
 		rsi_dbg(ERR_ZONE, "Unable to release TA threads\n");
-		return status;
+		goto err;
 	}
 
 	status = rsi_sdio_master_access_msword(adapter, MISC_CFG_BASE_ADDR);
 	if (status < 0) {
 		rsi_dbg(ERR_ZONE, "Unable to set ms word to common reg\n");
-		return status;
+		goto err;
 	}
 	rsi_dbg(INIT_ZONE, "***** TA Reset done *****\n");
 
-	return 0;
+err:
+	kfree(data);
+	return status;
 }
 
 static struct rsi_host_intf_ops sdio_host_intf_ops = {
-- 
2.22.0.rc1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 5.2] rsi: Properly initialize data in rsi_sdio_ta_reset
  2019-05-23 15:30 ` [PATCH v2 5.2] " Nathan Chancellor
@ 2019-05-28 11:33   ` Kalle Valo
  0 siblings, 0 replies; 11+ messages in thread
From: Kalle Valo @ 2019-05-28 11:33 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Amitkumar Karwar, Siva Rebbagondla, linux-wireless, netdev,
	linux-kernel, Arnd Bergmann, Nick Desaulniers, clang-built-linux,
	Nathan Chancellor

Nathan Chancellor <natechancellor@gmail.com> wrote:

> When building with -Wuninitialized, Clang warns:
> 
> drivers/net/wireless/rsi/rsi_91x_sdio.c:940:43: warning: variable 'data'
> is uninitialized when used here [-Wuninitialized]
>         put_unaligned_le32(TA_HOLD_THREAD_VALUE, data);
>                                                  ^~~~
> drivers/net/wireless/rsi/rsi_91x_sdio.c:930:10: note: initialize the
> variable 'data' to silence this warning
>         u8 *data;
>                 ^
>                  = NULL
> 1 warning generated.
> 
> Using Clang's suggestion of initializing data to NULL wouldn't work out
> because data will be dereferenced by put_unaligned_le32. Use kzalloc to
> properly initialize data, which matches a couple of other places in this
> driver.
> 
> Fixes: e5a1ecc97e5f ("rsi: add firmware loading for 9116 device")
> Link: https://github.com/ClangBuiltLinux/linux/issues/464
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>

Patch applied to wireless-drivers.git, thanks.

f57b5d85ed58 rsi: Properly initialize data in rsi_sdio_ta_reset

-- 
https://patchwork.kernel.org/patch/10958063/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-05-28 11:33 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-02 15:15 [PATCH] rsi: Properly initialize data in rsi_sdio_ta_reset Nathan Chancellor
2019-05-02 18:18 ` Nick Desaulniers
2019-05-03  3:17   ` Nathan Chancellor
2019-05-23  1:54     ` Nathan Chancellor
2019-05-23  8:51       ` Arnd Bergmann
2019-05-23  8:56         ` Kalle Valo
2019-05-23  8:52       ` Kalle Valo
2019-05-03  4:38   ` Kalle Valo
2019-05-06 20:51     ` Nathan Chancellor
2019-05-23 15:30 ` [PATCH v2 5.2] " Nathan Chancellor
2019-05-28 11:33   ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).