* [PATCH] of: fix expression using sizeof(void)
@ 2019-04-11 1:47 xiaojiangfeng
2019-04-11 5:06 ` Frank Rowand
0 siblings, 1 reply; 2+ messages in thread
From: xiaojiangfeng @ 2019-04-11 1:47 UTC (permalink / raw)
To: robh+dt, frowand.list, robh, grant.likely, xiaojiangfeng
Cc: devicetree, linux-kernel
problem detected by sparse:
drivers/of/fdt.c:1094:34: warning: expression using sizeof(void)
Signed-off-by: xiaojiangfeng <xiaojiangfeng@huawei.com>
---
drivers/of/fdt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 4734223..75c6c55 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -1091,7 +1091,7 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
/* Retrieve command line */
p = of_get_flat_dt_prop(node, "bootargs", &l);
if (p != NULL && l > 0)
- strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE));
+ strlcpy(data, p, COMMAND_LINE_SIZE);
/*
* CONFIG_CMDLINE is meant to be a default in case nothing else
--
1.8.5.6
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] of: fix expression using sizeof(void)
2019-04-11 1:47 [PATCH] of: fix expression using sizeof(void) xiaojiangfeng
@ 2019-04-11 5:06 ` Frank Rowand
0 siblings, 0 replies; 2+ messages in thread
From: Frank Rowand @ 2019-04-11 5:06 UTC (permalink / raw)
To: xiaojiangfeng, robh+dt, robh, grant.likely; +Cc: devicetree, linux-kernel
On 4/10/19 6:47 PM, xiaojiangfeng wrote:
> problem detected by sparse:
> drivers/of/fdt.c:1094:34: warning: expression using sizeof(void)
>
> Signed-off-by: xiaojiangfeng <xiaojiangfeng@huawei.com>
> ---
> drivers/of/fdt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index 4734223..75c6c55 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -1091,7 +1091,7 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
> /* Retrieve command line */
> p = of_get_flat_dt_prop(node, "bootargs", &l);
> if (p != NULL && l > 0)
> - strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE));
> + strlcpy(data, p, COMMAND_LINE_SIZE);
>
> /*
> * CONFIG_CMDLINE is meant to be a default in case nothing else
>
The fuller discussion is in the thread where you first attempted to fix an
issue with the line of code and I reported a sparse error against this line.
After digging deeper, your first patch is valid, removing min() here is not
the correct approach. I will add my Reviewed-by to the first patch and I
will pursue the sparse warning separately.
Thanks,
Frank
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-04-11 5:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-11 1:47 [PATCH] of: fix expression using sizeof(void) xiaojiangfeng
2019-04-11 5:06 ` Frank Rowand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®