Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1671667 > unrolled thread

[PATCH][net-next] qtnfmac: fix uninitialized return code in ret

Started byColin King <colin.king@canonical.com>
First post2017-06-21 15:30 +0200
Last post2017-06-28 20:00 +0200
Articles 4 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH][net-next] qtnfmac: fix uninitialized return code in ret Colin King <colin.king@canonical.com> - 2017-06-21 15:30 +0200
    Re: [PATCH][net-next] qtnfmac: fix uninitialized return code in ret Colin Ian King <colin.king@canonical.com> - 2017-06-21 16:00 +0200
    Re: [PATCH][net-next] qtnfmac: fix uninitialized return code in ret Dan Carpenter <dan.carpenter@oracle.com> - 2017-06-22 07:20 +0200
    Re: [net-next] qtnfmac: fix uninitialized return code in ret Kalle Valo <kvalo@codeaurora.org> - 2017-06-28 20:00 +0200

#1671667 — [PATCH][net-next] qtnfmac: fix uninitialized return code in ret

FromColin King <colin.king@canonical.com>
Date2017-06-21 15:30 +0200
Subject[PATCH][net-next] qtnfmac: fix uninitialized return code in ret
Message-ID<tUNRM-6Ci-23@gated-at.bofh.it>
From: Colin Ian King <colin.king@canonical.com>

The return value ret is unitialized and garbage is being returned
for the three different error conditions when setting up the PCIe
BARs. Fix this by initializing ret to  -ENOMEM to indicate that
the BARs failed to be setup correctly.

Detected by CoverityScan, CID#1437563 ("Unitialized scalar variable")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c
index f93b27f3a236..7fc4f0d6a9ad 100644
--- a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c
+++ b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c
@@ -247,7 +247,7 @@ static void qtnf_pcie_free_shm_ipc(struct qtnf_pcie_bus_priv *priv)
 
 static int qtnf_pcie_init_memory(struct qtnf_pcie_bus_priv *priv)
 {
-	int ret;
+	int ret = -ENOMEM;
 
 	priv->sysctl_bar = qtnf_map_bar(priv, QTN_SYSCTL_BAR);
 	if (IS_ERR_OR_NULL(priv->sysctl_bar)) {
-- 
2.11.0

[toc] | [next] | [standalone]


#1671690

FromColin Ian King <colin.king@canonical.com>
Date2017-06-21 16:00 +0200
Message-ID<tUOkO-6Mr-21@gated-at.bofh.it>
In reply to#1671667
On 21/06/17 14:54, Sergey Matyukevich wrote:
>> The return value ret is unitialized and garbage is being returned
>> for the three different error conditions when setting up the PCIe
>> BARs. Fix this by initializing ret to  -ENOMEM to indicate that
>> the BARs failed to be setup correctly.
>>
>> Detected by CoverityScan, CID#1437563 ("Unitialized scalar variable")
>>
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>> ---
>>  drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c
>> index f93b27f3a236..7fc4f0d6a9ad 100644
>> --- a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c
>> +++ b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c
>> @@ -247,7 +247,7 @@ static void qtnf_pcie_free_shm_ipc(struct qtnf_pcie_bus_priv *priv)
>>
>>  static int qtnf_pcie_init_memory(struct qtnf_pcie_bus_priv *priv)
>>  {
>> -       int ret;
>> +       int ret = -ENOMEM;
>>
>>         priv->sysctl_bar = qtnf_map_bar(priv, QTN_SYSCTL_BAR);
>>         if (IS_ERR_OR_NULL(priv->sysctl_bar)) {
>> --
> 
> Thanks !
> 
> Reviewed-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
> 
> By the way, could you please use the recepient list suggested by
> get_maintainer.pl script from the kernel scripts directory.

Yep, I did.

> 
> Regards,
> Sergey
> 

[toc] | [prev] | [next] | [standalone]


#1672308

FromDan Carpenter <dan.carpenter@oracle.com>
Date2017-06-22 07:20 +0200
Message-ID<tV2H7-8Q-1@gated-at.bofh.it>
In reply to#1671667
On Wed, Jun 21, 2017 at 02:25:30PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The return value ret is unitialized and garbage is being returned
> for the three different error conditions when setting up the PCIe
> BARs. Fix this by initializing ret to  -ENOMEM to indicate that
> the BARs failed to be setup correctly.
> 
> Detected by CoverityScan, CID#1437563 ("Unitialized scalar variable")
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c
> index f93b27f3a236..7fc4f0d6a9ad 100644
> --- a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c
> +++ b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c
> @@ -247,7 +247,7 @@ static void qtnf_pcie_free_shm_ipc(struct qtnf_pcie_bus_priv *priv)
>  
>  static int qtnf_pcie_init_memory(struct qtnf_pcie_bus_priv *priv)
>  {
> -	int ret;
> +	int ret = -ENOMEM;
>  
>  	priv->sysctl_bar = qtnf_map_bar(priv, QTN_SYSCTL_BAR);
>  	if (IS_ERR_OR_NULL(priv->sysctl_bar)) {

Not related to your patch but qtnf_map_bar() should be changed not to
return NULL.  When functions return both NULL and error pointers the
NULL is supposed to be a special type of success return.  Here it is
just a fail return where we forgot to set the error code to
ERR_PTR(-ENOMEM).

regards,
dan carpenter

[toc] | [prev] | [next] | [standalone]


#1676966 — Re: [net-next] qtnfmac: fix uninitialized return code in ret

FromKalle Valo <kvalo@codeaurora.org>
Date2017-06-28 20:00 +0200
SubjectRe: [net-next] qtnfmac: fix uninitialized return code in ret
Message-ID<tXpq2-t5-149@gated-at.bofh.it>
In reply to#1671667
Colin Ian King <colin.king@canonical.com> wrote:

> From: Colin Ian King <colin.king@canonical.com>
> 
> The return value ret is unitialized and garbage is being returned
> for the three different error conditions when setting up the PCIe
> BARs. Fix this by initializing ret to  -ENOMEM to indicate that
> the BARs failed to be setup correctly.
> 
> Detected by CoverityScan, CID#1437563 ("Unitialized scalar variable")
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> Reviewed-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>

Patch applied to wireless-drivers-next.git, thanks.

3e3d8aa61107 qtnfmac: fix uninitialized return code in ret

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

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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web