patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH] net/sfc: fix the argument to sizeof for unit cache
@ 2021-12-21  6:41 Weiguo Li
  2022-02-18 14:38 ` Ferruh Yigit
  0 siblings, 1 reply; 4+ messages in thread
From: Weiguo Li @ 2021-12-21  6:41 UTC (permalink / raw)
  To: andrew.rybchenko; +Cc: ivan.ilchenko, dev, stable

The size of unit cache should be sizeof(**cache) instead of
sizeof(*cache). Memory reallocation is inadequate by sizeof(*cache)
for the platform whose size of pointer is 32-bits. Found by coccinelle
(see https://coccinelle.gitlabpages.inria.fr/website) script.

Fixes: 63abf8d29225 ("net/sfc: support SW stats groups")
Cc: stable@dpdk.org

Signed-off-by: Weiguo Li <liwg06@foxmail.com>
---
 drivers/net/sfc/sfc_sw_stats.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/sfc/sfc_sw_stats.c b/drivers/net/sfc/sfc_sw_stats.c
index 70259660c0..81f5aa3cc4 100644
--- a/drivers/net/sfc/sfc_sw_stats.c
+++ b/drivers/net/sfc/sfc_sw_stats.c
@@ -777,7 +777,7 @@ sfc_sw_xstats_configure(struct sfc_adapter *sa)
 
 	memset(*reset_vals, 0, nb_supported * sizeof(**reset_vals));
 
-	*cache = rte_realloc(*cache, cache_count * sizeof(*cache), 0);
+	*cache = rte_realloc(*cache, cache_count * sizeof(**cache), 0);
 	if (*cache == NULL) {
 		rc = ENOMEM;
 		goto fail_cache;
-- 
2.25.1


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

* Re: [PATCH] net/sfc: fix the argument to sizeof for unit cache
  2021-12-21  6:41 [PATCH] net/sfc: fix the argument to sizeof for unit cache Weiguo Li
@ 2022-02-18 14:38 ` Ferruh Yigit
  2022-02-18 14:43   ` Andrew Rybchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Ferruh Yigit @ 2022-02-18 14:38 UTC (permalink / raw)
  To: Weiguo Li, andrew.rybchenko; +Cc: ivan.ilchenko, dev, stable

On 12/21/2021 6:41 AM, Weiguo Li wrote:
> The size of unit cache should be sizeof(**cache) instead of
> sizeof(*cache). Memory reallocation is inadequate by sizeof(*cache)
> for the platform whose size of pointer is 32-bits. Found by coccinelle
> (see https://coccinelle.gitlabpages.inria.fr/website) script.
> 
> Fixes: 63abf8d29225 ("net/sfc: support SW stats groups")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Weiguo Li <liwg06@foxmail.com>
> ---
>   drivers/net/sfc/sfc_sw_stats.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/sfc/sfc_sw_stats.c b/drivers/net/sfc/sfc_sw_stats.c
> index 70259660c0..81f5aa3cc4 100644
> --- a/drivers/net/sfc/sfc_sw_stats.c
> +++ b/drivers/net/sfc/sfc_sw_stats.c
> @@ -777,7 +777,7 @@ sfc_sw_xstats_configure(struct sfc_adapter *sa)
>   
>   	memset(*reset_vals, 0, nb_supported * sizeof(**reset_vals));
>   
> -	*cache = rte_realloc(*cache, cache_count * sizeof(*cache), 0);
> +	*cache = rte_realloc(*cache, cache_count * sizeof(**cache), 0);
>   	if (*cache == NULL) {
>   		rc = ENOMEM;
>   		goto fail_cache;


Hi Andrew, Ivan,

This patch seems missed, and it looks a valid fix to me.

Do you have any comment on patch?

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

* Re: [PATCH] net/sfc: fix the argument to sizeof for unit cache
  2022-02-18 14:38 ` Ferruh Yigit
@ 2022-02-18 14:43   ` Andrew Rybchenko
  2022-02-18 15:50     ` Ferruh Yigit
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Rybchenko @ 2022-02-18 14:43 UTC (permalink / raw)
  To: Ferruh Yigit, Weiguo Li; +Cc: ivan.ilchenko, dev, stable

On 2/18/22 17:38, Ferruh Yigit wrote:
> On 12/21/2021 6:41 AM, Weiguo Li wrote:
>> The size of unit cache should be sizeof(**cache) instead of
>> sizeof(*cache). Memory reallocation is inadequate by sizeof(*cache)
>> for the platform whose size of pointer is 32-bits. Found by coccinelle
>> (see https://coccinelle.gitlabpages.inria.fr/website) script.
>>
>> Fixes: 63abf8d29225 ("net/sfc: support SW stats groups")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Weiguo Li <liwg06@foxmail.com>
>> ---
>>   drivers/net/sfc/sfc_sw_stats.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/sfc/sfc_sw_stats.c 
>> b/drivers/net/sfc/sfc_sw_stats.c
>> index 70259660c0..81f5aa3cc4 100644
>> --- a/drivers/net/sfc/sfc_sw_stats.c
>> +++ b/drivers/net/sfc/sfc_sw_stats.c
>> @@ -777,7 +777,7 @@ sfc_sw_xstats_configure(struct sfc_adapter *sa)
>>       memset(*reset_vals, 0, nb_supported * sizeof(**reset_vals));
>> -    *cache = rte_realloc(*cache, cache_count * sizeof(*cache), 0);
>> +    *cache = rte_realloc(*cache, cache_count * sizeof(**cache), 0);
>>       if (*cache == NULL) {
>>           rc = ENOMEM;
>>           goto fail_cache;
> 
> 
> Hi Andrew, Ivan,
> 
> This patch seems missed, and it looks a valid fix to me.
> 
> Do you have any comment on patch?

Hi,

sorry, lost from my view as well.

Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>

Thanks,
Andrew.

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

* Re: [PATCH] net/sfc: fix the argument to sizeof for unit cache
  2022-02-18 14:43   ` Andrew Rybchenko
@ 2022-02-18 15:50     ` Ferruh Yigit
  0 siblings, 0 replies; 4+ messages in thread
From: Ferruh Yigit @ 2022-02-18 15:50 UTC (permalink / raw)
  To: Andrew Rybchenko, Weiguo Li; +Cc: ivan.ilchenko, dev, stable

On 2/18/2022 2:43 PM, Andrew Rybchenko wrote:
> On 2/18/22 17:38, Ferruh Yigit wrote:
>> On 12/21/2021 6:41 AM, Weiguo Li wrote:
>>> The size of unit cache should be sizeof(**cache) instead of
>>> sizeof(*cache). Memory reallocation is inadequate by sizeof(*cache)
>>> for the platform whose size of pointer is 32-bits. Found by coccinelle
>>> (see https://coccinelle.gitlabpages.inria.fr/website) script.
>>>
>>> Fixes: 63abf8d29225 ("net/sfc: support SW stats groups")
>>> Cc: stable@dpdk.org
>>>
>>> Signed-off-by: Weiguo Li <liwg06@foxmail.com>
> 
> Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> 

Applied to dpdk-next-net/main, thanks.


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

end of thread, other threads:[~2022-02-18 15:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-21  6:41 [PATCH] net/sfc: fix the argument to sizeof for unit cache Weiguo Li
2022-02-18 14:38 ` Ferruh Yigit
2022-02-18 14:43   ` Andrew Rybchenko
2022-02-18 15:50     ` Ferruh Yigit

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).