rptun: fix compile-time warning
Fix this compile-time warning: rptun/rptun.c:956:22: warning: '%lx' directive output may be truncated writing between 1 and 16 bytes into a region of size 14 [-Wformat-truncation=] 956 | snprintf(arg1, 16, "0x%" PRIxPTR, (uintptr_t)priv); | ^~~~~ rptun/rptun.c:956:25: note: format string is defined here 956 | snprintf(arg1, 16, "0x%" PRIxPTR, (uintptr_t)priv); rptun/rptun.c:956:22: note: directive argument in the range [1, 18446744073709551615] 956 | snprintf(arg1, 16, "0x%" PRIxPTR, (uintptr_t)priv); | ^~~~~ rptun/rptun.c:956:3: note: 'snprintf' output between 4 and 19 bytes into a destination of size 16 956 | snprintf(arg1, 16, "0x%" PRIxPTR, (uintptr_t)priv); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
This commit is contained in:
parent
5198a56fe8
commit
1caf7d6f17
@ -919,7 +919,7 @@ int rptun_initialize(FAR struct rptun_dev_s *dev)
|
||||
struct metal_init_params params = METAL_INIT_DEFAULTS;
|
||||
FAR struct rptun_priv_s *priv;
|
||||
FAR char *argv[3];
|
||||
char arg1[16];
|
||||
char arg1[19];
|
||||
char name[32];
|
||||
int ret;
|
||||
|
||||
@ -946,14 +946,14 @@ int rptun_initialize(FAR struct rptun_dev_s *dev)
|
||||
nxsem_init(&priv->sem, 0, RPTUN_IS_AUTOSTART(dev) ? 1 : 0);
|
||||
nxsem_set_protocol(&priv->sem, SEM_PRIO_NONE);
|
||||
|
||||
snprintf(name, 32, "/dev/rptun/%s", RPTUN_GET_CPUNAME(dev));
|
||||
snprintf(name, sizeof(name), "/dev/rptun/%s", RPTUN_GET_CPUNAME(dev));
|
||||
ret = register_driver(name, &g_rptun_devops, 0222, priv);
|
||||
if (ret < 0)
|
||||
{
|
||||
goto err_driver;
|
||||
}
|
||||
|
||||
snprintf(arg1, 16, "0x%" PRIxPTR, (uintptr_t)priv);
|
||||
snprintf(arg1, sizeof(arg1), "0x%" PRIxPTR, (uintptr_t)priv);
|
||||
argv[0] = (void *)RPTUN_GET_CPUNAME(dev);
|
||||
argv[1] = arg1;
|
||||
argv[2] = NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user