diff mbox series

[next] brcmfmac: firmware: Fix uninitialized variable ret

Message ID 20210803150904.80119-1-colin.king@canonical.com (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series [next] brcmfmac: firmware: Fix uninitialized variable ret | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Colin King Aug. 3, 2021, 3:09 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Currently the variable ret is uninitialized and is only set if
the pointer alt_path is non-null. Fix this by ininitializing ret
to zero.

Addresses-Coverity: ("Uninitialized scalar variable")
Fixes: 5ff013914c62 ("brcmfmac: firmware: Allow per-board firmware binaries")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Linus Walleij Aug. 3, 2021, 7:14 p.m. UTC | #1
On Tue, Aug 3, 2021 at 5:09 PM Colin King <colin.king@canonical.com> wrote:

> From: Colin Ian King <colin.king@canonical.com>
>
> Currently the variable ret is uninitialized and is only set if
> the pointer alt_path is non-null. Fix this by ininitializing ret
> to zero.
>
> Addresses-Coverity: ("Uninitialized scalar variable")
> Fixes: 5ff013914c62 ("brcmfmac: firmware: Allow per-board firmware binaries")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Nice catch!
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
Kalle Valo Aug. 5, 2021, 1:53 p.m. UTC | #2
Linus Walleij <linus.walleij@linaro.org> writes:

> On Tue, Aug 3, 2021 at 5:09 PM Colin King <colin.king@canonical.com> wrote:
>
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> Currently the variable ret is uninitialized and is only set if
>> the pointer alt_path is non-null. Fix this by ininitializing ret
>> to zero.
>>
>> Addresses-Coverity: ("Uninitialized scalar variable")
>> Fixes: 5ff013914c62 ("brcmfmac: firmware: Allow per-board firmware binaries")
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>
> Nice catch!
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

I assume this will be fixed by Linus' patch "brcmfmac: firmware: Fix
firmware loading" and I should drop Colin's patch, correct?
Arend van Spriel Aug. 6, 2021, 11:23 a.m. UTC | #3
On 05-08-2021 15:53, Kalle Valo wrote:
> Linus Walleij <linus.walleij@linaro.org> writes:
> 
>> On Tue, Aug 3, 2021 at 5:09 PM Colin King <colin.king@canonical.com> wrote:
>>
>>> From: Colin Ian King <colin.king@canonical.com>
>>>
>>> Currently the variable ret is uninitialized and is only set if
>>> the pointer alt_path is non-null. Fix this by ininitializing ret
>>> to zero.
>>>
>>> Addresses-Coverity: ("Uninitialized scalar variable")
>>> Fixes: 5ff013914c62 ("brcmfmac: firmware: Allow per-board firmware binaries")
>>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>>
>> Nice catch!
>> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> 
> I assume this will be fixed by Linus' patch "brcmfmac: firmware: Fix
> firmware loading" and I should drop Colin's patch, correct?

That would be my assumption as well, but not sure when he will submit 
another revision of it. You probably know what to do ;-)

Regards,
Arend
Colin King Aug. 6, 2021, 11:28 a.m. UTC | #4
On 06/08/2021 12:23, Arend van Spriel wrote:
> On 05-08-2021 15:53, Kalle Valo wrote:
>> Linus Walleij <linus.walleij@linaro.org> writes:
>>
>>> On Tue, Aug 3, 2021 at 5:09 PM Colin King <colin.king@canonical.com>
>>> wrote:
>>>
>>>> From: Colin Ian King <colin.king@canonical.com>
>>>>
>>>> Currently the variable ret is uninitialized and is only set if
>>>> the pointer alt_path is non-null. Fix this by ininitializing ret
>>>> to zero.
>>>>
>>>> Addresses-Coverity: ("Uninitialized scalar variable")
>>>> Fixes: 5ff013914c62 ("brcmfmac: firmware: Allow per-board firmware
>>>> binaries")
>>>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>>>
>>> Nice catch!
>>> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
>>
>> I assume this will be fixed by Linus' patch "brcmfmac: firmware: Fix
>> firmware loading" and I should drop Colin's patch, correct?
> 
> That would be my assumption as well, but not sure when he will submit
> another revision of it. You probably know what to do ;-)

I'd prefer my patch to be dropped in preference to Linus' fix.

> 
> Regards,
> Arend
Kalle Valo Aug. 6, 2021, 12:35 p.m. UTC | #5
Colin Ian King <colin.king@canonical.com> writes:

> On 06/08/2021 12:23, Arend van Spriel wrote:
>> On 05-08-2021 15:53, Kalle Valo wrote:
>>> Linus Walleij <linus.walleij@linaro.org> writes:
>>>
>>>> On Tue, Aug 3, 2021 at 5:09 PM Colin King <colin.king@canonical.com>
>>>> wrote:
>>>>
>>>>> From: Colin Ian King <colin.king@canonical.com>
>>>>>
>>>>> Currently the variable ret is uninitialized and is only set if
>>>>> the pointer alt_path is non-null. Fix this by ininitializing ret
>>>>> to zero.
>>>>>
>>>>> Addresses-Coverity: ("Uninitialized scalar variable")
>>>>> Fixes: 5ff013914c62 ("brcmfmac: firmware: Allow per-board firmware
>>>>> binaries")
>>>>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>>>>
>>>> Nice catch!
>>>> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
>>>
>>> I assume this will be fixed by Linus' patch "brcmfmac: firmware: Fix
>>> firmware loading" and I should drop Colin's patch, correct?
>> 
>> That would be my assumption as well, but not sure when he will submit
>> another revision of it. You probably know what to do ;-)
>
> I'd prefer my patch to be dropped in preference to Linus' fix.

Ok, I'll then drop Colin's patch.
diff mbox series

Patch

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
index adfdfc654b10..4f387e868120 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
@@ -680,7 +680,7 @@  int brcmf_fw_get_firmwares(struct device *dev, struct brcmf_fw_request *req,
 	struct brcmf_fw_item *first = &req->items[0];
 	struct brcmf_fw *fwctx;
 	char *alt_path;
-	int ret;
+	int ret = 0;
 
 	brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(dev));
 	if (!fw_cb)