All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ath11k: do not return random value
@ 2022-04-04 10:53 ` Michael Straube
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Straube @ 2022-04-04 10:53 UTC (permalink / raw)
  To: kvalo
  Cc: davem, kuba, ath11k, linux-wireless, netdev, linux-kernel,
	Michael Straube

Function ath11k_qmi_assign_target_mem_chunk() returns a random value
if of_parse_phandle() fails because the return variable ret is not
initialized before calling of_parse_phandle(). Return -EINVAL to avoid
possibly returning 0, which would be wrong here.

Issue found by smatch.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
 drivers/net/wireless/ath/ath11k/qmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c
index 65d3c6ba35ae..81b2304b1fde 100644
--- a/drivers/net/wireless/ath/ath11k/qmi.c
+++ b/drivers/net/wireless/ath/ath11k/qmi.c
@@ -1932,7 +1932,7 @@ static int ath11k_qmi_assign_target_mem_chunk(struct ath11k_base *ab)
 			if (!hremote_node) {
 				ath11k_dbg(ab, ATH11K_DBG_QMI,
 					   "qmi fail to get hremote_node\n");
-				return ret;
+				return -EINVAL;
 			}
 
 			ret = of_address_to_resource(hremote_node, 0, &res);
-- 
2.35.1


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

* [PATCH] ath11k: do not return random value
@ 2022-04-04 10:53 ` Michael Straube
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Straube @ 2022-04-04 10:53 UTC (permalink / raw)
  To: kvalo
  Cc: davem, kuba, ath11k, linux-wireless, netdev, linux-kernel,
	Michael Straube

Function ath11k_qmi_assign_target_mem_chunk() returns a random value
if of_parse_phandle() fails because the return variable ret is not
initialized before calling of_parse_phandle(). Return -EINVAL to avoid
possibly returning 0, which would be wrong here.

Issue found by smatch.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
 drivers/net/wireless/ath/ath11k/qmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c
index 65d3c6ba35ae..81b2304b1fde 100644
--- a/drivers/net/wireless/ath/ath11k/qmi.c
+++ b/drivers/net/wireless/ath/ath11k/qmi.c
@@ -1932,7 +1932,7 @@ static int ath11k_qmi_assign_target_mem_chunk(struct ath11k_base *ab)
 			if (!hremote_node) {
 				ath11k_dbg(ab, ATH11K_DBG_QMI,
 					   "qmi fail to get hremote_node\n");
-				return ret;
+				return -EINVAL;
 			}
 
 			ret = of_address_to_resource(hremote_node, 0, &res);
-- 
2.35.1


-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

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

* Re: [PATCH] ath11k: do not return random value
  2022-04-04 10:53 ` Michael Straube
@ 2022-04-04 16:35   ` Robert Marko
  -1 siblings, 0 replies; 8+ messages in thread
From: Robert Marko @ 2022-04-04 16:35 UTC (permalink / raw)
  To: Michael Straube
  Cc: kvalo, David Miller, kuba, ath11k, linux-wireless, netdev,
	Linux Kernel Mailing List

On Mon, Apr 4, 2022 at 12:54 PM Michael Straube <straube.linux@gmail.com> wrote:
>
> Function ath11k_qmi_assign_target_mem_chunk() returns a random value
> if of_parse_phandle() fails because the return variable ret is not
> initialized before calling of_parse_phandle(). Return -EINVAL to avoid
> possibly returning 0, which would be wrong here.
>
> Issue found by smatch.
>
> Signed-off-by: Michael Straube <straube.linux@gmail.com>
> ---
>  drivers/net/wireless/ath/ath11k/qmi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c
> index 65d3c6ba35ae..81b2304b1fde 100644
> --- a/drivers/net/wireless/ath/ath11k/qmi.c
> +++ b/drivers/net/wireless/ath/ath11k/qmi.c
> @@ -1932,7 +1932,7 @@ static int ath11k_qmi_assign_target_mem_chunk(struct ath11k_base *ab)
>                         if (!hremote_node) {
>                                 ath11k_dbg(ab, ATH11K_DBG_QMI,
>                                            "qmi fail to get hremote_node\n");
> -                               return ret;
> +                               return -EINVAL;
>                         }
>
>                         ret = of_address_to_resource(hremote_node, 0, &res);
> --
> 2.35.1

Hi Michael,
This is already solved in ath-next and 5.18-rc1:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/net/wireless/ath/ath11k/qmi.c?h=v5.18-rc1&id=c9b41832dc080fa59bad597de94865b3ea2d5bab

Regards,
Robert
>
>
> --
> ath11k mailing list
> ath11k@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/ath11k



-- 
Robert Marko
Staff Embedded Linux Engineer
Sartura Ltd.
Lendavska ulica 16a
10000 Zagreb, Croatia
Email: robert.marko@sartura.hr
Web: www.sartura.hr

-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

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

* Re: [PATCH] ath11k: do not return random value
@ 2022-04-04 16:35   ` Robert Marko
  0 siblings, 0 replies; 8+ messages in thread
From: Robert Marko @ 2022-04-04 16:35 UTC (permalink / raw)
  To: Michael Straube
  Cc: kvalo, David Miller, kuba, ath11k, linux-wireless, netdev,
	Linux Kernel Mailing List

On Mon, Apr 4, 2022 at 12:54 PM Michael Straube <straube.linux@gmail.com> wrote:
>
> Function ath11k_qmi_assign_target_mem_chunk() returns a random value
> if of_parse_phandle() fails because the return variable ret is not
> initialized before calling of_parse_phandle(). Return -EINVAL to avoid
> possibly returning 0, which would be wrong here.
>
> Issue found by smatch.
>
> Signed-off-by: Michael Straube <straube.linux@gmail.com>
> ---
>  drivers/net/wireless/ath/ath11k/qmi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c
> index 65d3c6ba35ae..81b2304b1fde 100644
> --- a/drivers/net/wireless/ath/ath11k/qmi.c
> +++ b/drivers/net/wireless/ath/ath11k/qmi.c
> @@ -1932,7 +1932,7 @@ static int ath11k_qmi_assign_target_mem_chunk(struct ath11k_base *ab)
>                         if (!hremote_node) {
>                                 ath11k_dbg(ab, ATH11K_DBG_QMI,
>                                            "qmi fail to get hremote_node\n");
> -                               return ret;
> +                               return -EINVAL;
>                         }
>
>                         ret = of_address_to_resource(hremote_node, 0, &res);
> --
> 2.35.1

Hi Michael,
This is already solved in ath-next and 5.18-rc1:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/net/wireless/ath/ath11k/qmi.c?h=v5.18-rc1&id=c9b41832dc080fa59bad597de94865b3ea2d5bab

Regards,
Robert
>
>
> --
> ath11k mailing list
> ath11k@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/ath11k



-- 
Robert Marko
Staff Embedded Linux Engineer
Sartura Ltd.
Lendavska ulica 16a
10000 Zagreb, Croatia
Email: robert.marko@sartura.hr
Web: www.sartura.hr

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

* Re: [PATCH] ath11k: do not return random value
  2022-04-04 16:35   ` Robert Marko
@ 2022-04-04 16:45     ` Michael Straube
  -1 siblings, 0 replies; 8+ messages in thread
From: Michael Straube @ 2022-04-04 16:45 UTC (permalink / raw)
  To: Robert Marko
  Cc: kvalo, David Miller, kuba, ath11k, linux-wireless, netdev,
	Linux Kernel Mailing List

On 4/4/22 18:35, Robert Marko wrote:
> On Mon, Apr 4, 2022 at 12:54 PM Michael Straube <straube.linux@gmail.com> wrote:
>>
>> Function ath11k_qmi_assign_target_mem_chunk() returns a random value
>> if of_parse_phandle() fails because the return variable ret is not
>> initialized before calling of_parse_phandle(). Return -EINVAL to avoid
>> possibly returning 0, which would be wrong here.
>>
>> Issue found by smatch.
>>
>> Signed-off-by: Michael Straube <straube.linux@gmail.com>
>> ---
>>   drivers/net/wireless/ath/ath11k/qmi.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c
>> index 65d3c6ba35ae..81b2304b1fde 100644
>> --- a/drivers/net/wireless/ath/ath11k/qmi.c
>> +++ b/drivers/net/wireless/ath/ath11k/qmi.c
>> @@ -1932,7 +1932,7 @@ static int ath11k_qmi_assign_target_mem_chunk(struct ath11k_base *ab)
>>                          if (!hremote_node) {
>>                                  ath11k_dbg(ab, ATH11K_DBG_QMI,
>>                                             "qmi fail to get hremote_node\n");
>> -                               return ret;
>> +                               return -EINVAL;
>>                          }
>>
>>                          ret = of_address_to_resource(hremote_node, 0, &res);
>> --
>> 2.35.1
> 
> Hi Michael,
> This is already solved in ath-next and 5.18-rc1:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/net/wireless/ath/ath11k/qmi.c?h=v5.18-rc1&id=c9b41832dc080fa59bad597de94865b3ea2d5bab
> 

Hi Robert,

Ah ok, then I worked with the wrong tree (wireless-drivers-next).
Sorry for the noise.

regards,
Michael



-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

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

* Re: [PATCH] ath11k: do not return random value
@ 2022-04-04 16:45     ` Michael Straube
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Straube @ 2022-04-04 16:45 UTC (permalink / raw)
  To: Robert Marko
  Cc: kvalo, David Miller, kuba, ath11k, linux-wireless, netdev,
	Linux Kernel Mailing List

On 4/4/22 18:35, Robert Marko wrote:
> On Mon, Apr 4, 2022 at 12:54 PM Michael Straube <straube.linux@gmail.com> wrote:
>>
>> Function ath11k_qmi_assign_target_mem_chunk() returns a random value
>> if of_parse_phandle() fails because the return variable ret is not
>> initialized before calling of_parse_phandle(). Return -EINVAL to avoid
>> possibly returning 0, which would be wrong here.
>>
>> Issue found by smatch.
>>
>> Signed-off-by: Michael Straube <straube.linux@gmail.com>
>> ---
>>   drivers/net/wireless/ath/ath11k/qmi.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c
>> index 65d3c6ba35ae..81b2304b1fde 100644
>> --- a/drivers/net/wireless/ath/ath11k/qmi.c
>> +++ b/drivers/net/wireless/ath/ath11k/qmi.c
>> @@ -1932,7 +1932,7 @@ static int ath11k_qmi_assign_target_mem_chunk(struct ath11k_base *ab)
>>                          if (!hremote_node) {
>>                                  ath11k_dbg(ab, ATH11K_DBG_QMI,
>>                                             "qmi fail to get hremote_node\n");
>> -                               return ret;
>> +                               return -EINVAL;
>>                          }
>>
>>                          ret = of_address_to_resource(hremote_node, 0, &res);
>> --
>> 2.35.1
> 
> Hi Michael,
> This is already solved in ath-next and 5.18-rc1:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/net/wireless/ath/ath11k/qmi.c?h=v5.18-rc1&id=c9b41832dc080fa59bad597de94865b3ea2d5bab
> 

Hi Robert,

Ah ok, then I worked with the wrong tree (wireless-drivers-next).
Sorry for the noise.

regards,
Michael



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

* Re: [PATCH] ath11k: do not return random value
  2022-04-04 16:45     ` Michael Straube
@ 2022-04-04 16:51       ` Kalle Valo
  -1 siblings, 0 replies; 8+ messages in thread
From: Kalle Valo @ 2022-04-04 16:51 UTC (permalink / raw)
  To: Michael Straube
  Cc: Robert Marko, David Miller, kuba, ath11k, linux-wireless, netdev,
	Linux Kernel Mailing List

Michael Straube <straube.linux@gmail.com> writes:

> On 4/4/22 18:35, Robert Marko wrote:
>> On Mon, Apr 4, 2022 at 12:54 PM Michael Straube <straube.linux@gmail.com> wrote:
>>>
>>> Function ath11k_qmi_assign_target_mem_chunk() returns a random value
>>> if of_parse_phandle() fails because the return variable ret is not
>>> initialized before calling of_parse_phandle(). Return -EINVAL to avoid
>>> possibly returning 0, which would be wrong here.
>>>
>>> Issue found by smatch.
>>>
>>> Signed-off-by: Michael Straube <straube.linux@gmail.com>
>>> ---
>>>   drivers/net/wireless/ath/ath11k/qmi.c | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c
>>> index 65d3c6ba35ae..81b2304b1fde 100644
>>> --- a/drivers/net/wireless/ath/ath11k/qmi.c
>>> +++ b/drivers/net/wireless/ath/ath11k/qmi.c
>>> @@ -1932,7 +1932,7 @@ static int ath11k_qmi_assign_target_mem_chunk(struct ath11k_base *ab)
>>>                          if (!hremote_node) {
>>>                                  ath11k_dbg(ab, ATH11K_DBG_QMI,
>>>                                             "qmi fail to get hremote_node\n");
>>> -                               return ret;
>>> +                               return -EINVAL;
>>>                          }
>>>
>>>                          ret = of_address_to_resource(hremote_node, 0, &res);
>>> --
>>> 2.35.1
>>
>> Hi Michael,
>> This is already solved in ath-next and 5.18-rc1:
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/net/wireless/ath/ath11k/qmi.c?h=v5.18-rc1&id=c9b41832dc080fa59bad597de94865b3ea2d5bab
>>
>
> Hi Robert,
>
> Ah ok, then I worked with the wrong tree (wireless-drivers-next).
> Sorry for the noise.

wireless-drivers[-next] and mac80211[-next] trees are not in use
anymore, we switched to using a common wireless and wireless-next trees:

https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless.git/

https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git/

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

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

-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

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

* Re: [PATCH] ath11k: do not return random value
@ 2022-04-04 16:51       ` Kalle Valo
  0 siblings, 0 replies; 8+ messages in thread
From: Kalle Valo @ 2022-04-04 16:51 UTC (permalink / raw)
  To: Michael Straube
  Cc: Robert Marko, David Miller, kuba, ath11k, linux-wireless, netdev,
	Linux Kernel Mailing List

Michael Straube <straube.linux@gmail.com> writes:

> On 4/4/22 18:35, Robert Marko wrote:
>> On Mon, Apr 4, 2022 at 12:54 PM Michael Straube <straube.linux@gmail.com> wrote:
>>>
>>> Function ath11k_qmi_assign_target_mem_chunk() returns a random value
>>> if of_parse_phandle() fails because the return variable ret is not
>>> initialized before calling of_parse_phandle(). Return -EINVAL to avoid
>>> possibly returning 0, which would be wrong here.
>>>
>>> Issue found by smatch.
>>>
>>> Signed-off-by: Michael Straube <straube.linux@gmail.com>
>>> ---
>>>   drivers/net/wireless/ath/ath11k/qmi.c | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c
>>> index 65d3c6ba35ae..81b2304b1fde 100644
>>> --- a/drivers/net/wireless/ath/ath11k/qmi.c
>>> +++ b/drivers/net/wireless/ath/ath11k/qmi.c
>>> @@ -1932,7 +1932,7 @@ static int ath11k_qmi_assign_target_mem_chunk(struct ath11k_base *ab)
>>>                          if (!hremote_node) {
>>>                                  ath11k_dbg(ab, ATH11K_DBG_QMI,
>>>                                             "qmi fail to get hremote_node\n");
>>> -                               return ret;
>>> +                               return -EINVAL;
>>>                          }
>>>
>>>                          ret = of_address_to_resource(hremote_node, 0, &res);
>>> --
>>> 2.35.1
>>
>> Hi Michael,
>> This is already solved in ath-next and 5.18-rc1:
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/net/wireless/ath/ath11k/qmi.c?h=v5.18-rc1&id=c9b41832dc080fa59bad597de94865b3ea2d5bab
>>
>
> Hi Robert,
>
> Ah ok, then I worked with the wrong tree (wireless-drivers-next).
> Sorry for the noise.

wireless-drivers[-next] and mac80211[-next] trees are not in use
anymore, we switched to using a common wireless and wireless-next trees:

https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless.git/

https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git/

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

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

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

end of thread, other threads:[~2022-04-04 21:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-04 10:53 [PATCH] ath11k: do not return random value Michael Straube
2022-04-04 10:53 ` Michael Straube
2022-04-04 16:35 ` Robert Marko
2022-04-04 16:35   ` Robert Marko
2022-04-04 16:45   ` Michael Straube
2022-04-04 16:45     ` Michael Straube
2022-04-04 16:51     ` Kalle Valo
2022-04-04 16:51       ` Kalle Valo

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.