All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] soc: kunpeng_hccs: fix size_t format string
@ 2023-08-12 17:21 Arnd Bergmann
  2023-08-14  0:56 ` Wei Xu
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2023-08-12 17:21 UTC (permalink / raw)
  To: Huisong Li, Wei Xu; +Cc: Arnd Bergmann, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

Printing a size_t using the %lu format string causes a warning on
architectures that define the type as 'unsigned int':

In file included from include/linux/device.h:15,
                 from include/linux/acpi.h:14,
                 from drivers/soc/hisilicon/kunpeng_hccs.c:25:
drivers/soc/hisilicon/kunpeng_hccs.c: In function 'hccs_get_bd_info':
drivers/soc/hisilicon/kunpeng_hccs.c:441:25: error: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Werror=format=]

Use the correct %zu format instead.

Fixes: 886bdf9c883bc ("soc: hisilicon: Support HCCS driver on Kunpeng SoC")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
I've already applied this one on top of the soc/drivers branch after I
merged the branch with the new driver and noticed the regression.

 drivers/soc/hisilicon/kunpeng_hccs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/hisilicon/kunpeng_hccs.c b/drivers/soc/hisilicon/kunpeng_hccs.c
index 6864d203c6782..0d6f6bacd3f62 100644
--- a/drivers/soc/hisilicon/kunpeng_hccs.c
+++ b/drivers/soc/hisilicon/kunpeng_hccs.c
@@ -438,7 +438,7 @@ static int hccs_get_bd_info(struct hccs_dev *hdev, u8 opcode,
 	head = &rsp->rsp_head;
 	if (head->data_len > buf_len) {
 		dev_err(hdev->dev,
-			"buffer overflow (buf_len = %lu, data_len = %u)!\n",
+			"buffer overflow (buf_len = %zu, data_len = %u)!\n",
 			buf_len, head->data_len);
 		return -ENOMEM;
 	}
-- 
2.39.2


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

* Re: [PATCH] soc: kunpeng_hccs: fix size_t format string
  2023-08-12 17:21 [PATCH] soc: kunpeng_hccs: fix size_t format string Arnd Bergmann
@ 2023-08-14  0:56 ` Wei Xu
  2023-08-14  3:52   ` lihuisong (C)
  0 siblings, 1 reply; 3+ messages in thread
From: Wei Xu @ 2023-08-14  0:56 UTC (permalink / raw)
  To: Arnd Bergmann, Huisong Li; +Cc: Arnd Bergmann, linux-kernel

Hi Arnd,

On 2023/8/13 1:21, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> Printing a size_t using the %lu format string causes a warning on
> architectures that define the type as 'unsigned int':
> 
> In file included from include/linux/device.h:15,
>                  from include/linux/acpi.h:14,
>                  from drivers/soc/hisilicon/kunpeng_hccs.c:25:
> drivers/soc/hisilicon/kunpeng_hccs.c: In function 'hccs_get_bd_info':
> drivers/soc/hisilicon/kunpeng_hccs.c:441:25: error: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Werror=format=]
> 
> Use the correct %zu format instead.
> 
> Fixes: 886bdf9c883bc ("soc: hisilicon: Support HCCS driver on Kunpeng SoC")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> I've already applied this one on top of the soc/drivers branch after I
> merged the branch with the new driver and noticed the regression.
> 
>  drivers/soc/hisilicon/kunpeng_hccs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/soc/hisilicon/kunpeng_hccs.c b/drivers/soc/hisilicon/kunpeng_hccs.c
> index 6864d203c6782..0d6f6bacd3f62 100644
> --- a/drivers/soc/hisilicon/kunpeng_hccs.c
> +++ b/drivers/soc/hisilicon/kunpeng_hccs.c
> @@ -438,7 +438,7 @@ static int hccs_get_bd_info(struct hccs_dev *hdev, u8 opcode,
>  	head = &rsp->rsp_head;
>  	if (head->data_len > buf_len) {
>  		dev_err(hdev->dev,
> -			"buffer overflow (buf_len = %lu, data_len = %u)!\n",
> +			"buffer overflow (buf_len = %zu, data_len = %u)!\n",
>  			buf_len, head->data_len);
>  		return -ENOMEM;
>  	}
> 

Thanks!

Best Regards,
Wei

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

* Re: [PATCH] soc: kunpeng_hccs: fix size_t format string
  2023-08-14  0:56 ` Wei Xu
@ 2023-08-14  3:52   ` lihuisong (C)
  0 siblings, 0 replies; 3+ messages in thread
From: lihuisong (C) @ 2023-08-14  3:52 UTC (permalink / raw)
  To: Wei Xu, Arnd Bergmann; +Cc: Arnd Bergmann, linux-kernel

Thanks Arnd,

Acked-by: Huisong Li <lihuisong@huawei.com>

在 2023/8/14 8:56, Wei Xu 写道:
> Hi Arnd,
>
> On 2023/8/13 1:21, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@arndb.de>
>>
>> Printing a size_t using the %lu format string causes a warning on
>> architectures that define the type as 'unsigned int':
>>
>> In file included from include/linux/device.h:15,
>>                   from include/linux/acpi.h:14,
>>                   from drivers/soc/hisilicon/kunpeng_hccs.c:25:
>> drivers/soc/hisilicon/kunpeng_hccs.c: In function 'hccs_get_bd_info':
>> drivers/soc/hisilicon/kunpeng_hccs.c:441:25: error: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Werror=format=]
>>
>> Use the correct %zu format instead.
>>
>> Fixes: 886bdf9c883bc ("soc: hisilicon: Support HCCS driver on Kunpeng SoC")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> ---
>> I've already applied this one on top of the soc/drivers branch after I
>> merged the branch with the new driver and noticed the regression.
>>
>>   drivers/soc/hisilicon/kunpeng_hccs.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/soc/hisilicon/kunpeng_hccs.c b/drivers/soc/hisilicon/kunpeng_hccs.c
>> index 6864d203c6782..0d6f6bacd3f62 100644
>> --- a/drivers/soc/hisilicon/kunpeng_hccs.c
>> +++ b/drivers/soc/hisilicon/kunpeng_hccs.c
>> @@ -438,7 +438,7 @@ static int hccs_get_bd_info(struct hccs_dev *hdev, u8 opcode,
>>   	head = &rsp->rsp_head;
>>   	if (head->data_len > buf_len) {
>>   		dev_err(hdev->dev,
>> -			"buffer overflow (buf_len = %lu, data_len = %u)!\n",
>> +			"buffer overflow (buf_len = %zu, data_len = %u)!\n",
>>   			buf_len, head->data_len);
>>   		return -ENOMEM;
>>   	}
>>
> Thanks!
>
> Best Regards,
> Wei
> .

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

end of thread, other threads:[~2023-08-14  3:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-12 17:21 [PATCH] soc: kunpeng_hccs: fix size_t format string Arnd Bergmann
2023-08-14  0:56 ` Wei Xu
2023-08-14  3:52   ` lihuisong (C)

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.