Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From 8ecb54080f9bfe2232d788a455be8a6617c2c838 Mon Sep 17 00:00:00 2001
- From: Arnd Bergmann <[email protected]>
- Date: Fri, 28 Jul 2017 11:48:19 +0200
- Subject: [PATCH] shut up more -Wformat-overflow warnings
- This seems to be a false-positive coming from a bad gcc optimization step:
- security/keys/proc.c: In function 'proc_keys_show':
- security/keys/proc.c:232:19: error: '%lu' directive writing between 1 and 20 bytes into a region of size 16 [-Werror=format-overflow=]
- sound/soc/fsl/fsl_sai.c: In function 'fsl_sai_probe':
- sound/soc/fsl/fsl_sai.c:837:21: error: '%d' directive writing between 1 and 10 bytes into a region of size 4 [-Werror=format-overflow=]
- drivers/block/cciss.c: In function 'cciss_init_one':
- drivers/block/cciss.c:5039:28: error: '%d' directive writing between 1 and 10 bytes into a region of size 3 [-Werror=format-overflow=]
- sound/isa/gus/gus_mem_proc.c: In function 'snd_gf1_mem_proc_init':
- sound/isa/gus/gus_mem_proc.c:72:27: error: '%i' directive writing between 1 and 10 bytes into a region of size 8 [-Werror=format-overflow=]
- sprintf(name, "gus-ram-%i", idx);
- ^~
- sound/isa/gus/gus_mem_proc.c:72:18: note: directive argument in the range [0, 2147483646]
- sprintf(name, "gus-ram-%i", idx);
- ^~~~~~~~~~~~
- sound/isa/gus/gus_mem_proc.c:72:4: note: 'sprintf' output between 10 and 19 bytes into a destination of size 16
- sprintf(name, "gus-ram-%i", idx);
- drivers/net/ethernet/marvell/mvneta_bm.c: In function 'mvneta_bm_probe':
- drivers/net/ethernet/marvell/mvneta_bm.c:306:17: error: ',capacity' directive writing 9 bytes into a region of size between 1 and 10 [-Werror=format-overflow=]
- sprintf(prop, "pool%d,capacity", i);
- ^~~~~~~~~~~~~~~~~
- drivers/net/ethernet/marvell/mvneta_bm.c:306:3: note: 'sprintf' output between 15 and 24 bytes into a destination of size 15
- sprintf(prop, "pool%d,capacity", i);
- drivers/pnp/pnpbios/proc.c: In function 'pnpbios_proc_exit':
- drivers/pnp/pnpbios/proc.c:338:18: error: '%02x' directive writing between 2 and 8 bytes into a region of size 3 [-Werror=format-overflow=]
- sprintf(name, "%02x", i);
- ^~~~
- drivers/pnp/pnpbios/proc.c:338:17: note: directive argument in the range [0, 2147483646]
- sprintf(name, "%02x", i);
- ^~~~~~
- drivers/pnp/pnpbios/proc.c:338:3: note: 'sprintf' output between 3 and 9 bytes into a destination of size 3
- drivers/mfd/max77620.c: In function 'max77620_probe':
- drivers/mfd/max77620.c:282:25: error: '%d' directive writing between 1 and 10 bytes into a region of size 7 [-Werror=format-overflow=]
- sprintf(fps_name, fps%d, fps_id);
- ^~
- drivers/mfd/max77620.c:282:21: note: directive argument in the range [0, 2147483646]
- sprintf(fps_name, fps%d, fps_id);
- ^~~~~~~
- drivers/mfd/max77620.c:282:3: note: 'sprintf' output between 5 and 14 bytes into a destination of size 10
- sprintf(fps_name, fps%d, fps_id);
- Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81592
- Signed-off-by: Arnd Bergmann <[email protected]>
- diff --git a/drivers/mfd/max77620.c b/drivers/mfd/max77620.c
- index b1700b5fa640..7569d2387de5 100644
- --- a/drivers/mfd/max77620.c
- +++ b/drivers/mfd/max77620.c
- @@ -279,7 +279,7 @@ static int max77620_config_fps(struct max77620_chip *chip,
- }
- for (fps_id = 0; fps_id < MAX77620_FPS_COUNT; fps_id++) {
- - sprintf(fps_name, "fps%d", fps_id);
- + sprintf(fps_name, "fps%hhd", fps_id);
- if (!strcmp(fps_np->name, fps_name))
- break;
- }
- diff --git a/drivers/net/ethernet/marvell/mvneta_bm.c b/drivers/net/ethernet/marvell/mvneta_bm.c
- index 466939f8f0cf..51473c4d8b8c 100644
- --- a/drivers/net/ethernet/marvell/mvneta_bm.c
- +++ b/drivers/net/ethernet/marvell/mvneta_bm.c
- @@ -303,22 +303,22 @@ static void mvneta_bm_pools_init(struct mvneta_bm *priv)
- mvneta_bm_write(priv, MVNETA_BM_POOL_WRITE_PTR_REG(i), 0);
- /* Configure pool size according to DT or use default value */
- - sprintf(prop, "pool%d,capacity", i);
- + snprintf(prop, sizeof(prop), "pool%hhd,capacity", i);
- if (of_property_read_u32(dn, prop, &size)) {
- size = MVNETA_BM_POOL_CAP_DEF;
- } else if (size > MVNETA_BM_POOL_CAP_MAX) {
- dev_warn(&priv->pdev->dev,
- - "Illegal pool %d capacity %d, set to %d\n",
- + "Illegal pool %hhd capacity %d, set to %d\n",
- i, size, MVNETA_BM_POOL_CAP_MAX);
- size = MVNETA_BM_POOL_CAP_MAX;
- } else if (size < MVNETA_BM_POOL_CAP_MIN) {
- dev_warn(&priv->pdev->dev,
- - "Illegal pool %d capacity %d, set to %d\n",
- + "Illegal pool %hhd capacity %d, set to %d\n",
- i, size, MVNETA_BM_POOL_CAP_MIN);
- size = MVNETA_BM_POOL_CAP_MIN;
- } else if (!IS_ALIGNED(size, MVNETA_BM_POOL_CAP_ALIGN)) {
- dev_warn(&priv->pdev->dev,
- - "Illegal pool %d capacity %d, round to %d\n",
- + "Illegal pool %hhd capacity %d, round to %d\n",
- i, size, ALIGN(size,
- MVNETA_BM_POOL_CAP_ALIGN));
- size = ALIGN(size, MVNETA_BM_POOL_CAP_ALIGN);
- @@ -329,7 +329,7 @@ static void mvneta_bm_pools_init(struct mvneta_bm *priv)
- bm_pool->hwbm_pool.size);
- /* Obtain custom pkt_size from DT */
- - sprintf(prop, "pool%d,pkt-size", i);
- + snprintf(prop, sizeof(prop), "pool%hhd,pkt-size", i);
- if (of_property_read_u32(dn, prop, &bm_pool->pkt_size))
- bm_pool->pkt_size = 0;
- }
- diff --git a/drivers/pnp/pnpbios/proc.c b/drivers/pnp/pnpbios/proc.c
- index 5ee6b2a5f8d5..2b1c9df27bbb 100644
- --- a/drivers/pnp/pnpbios/proc.c
- +++ b/drivers/pnp/pnpbios/proc.c
- @@ -335,7 +335,7 @@ void __exit pnpbios_proc_exit(void)
- return;
- for (i = 0; i < 0xff; i++) {
- - sprintf(name, "%02x", i);
- + snprintf(name, sizeof(name), "%02hhx", i);
- if (!pnpbios_dont_use_current_config)
- remove_proc_entry(name, proc_pnp);
- remove_proc_entry(name, proc_pnp_boot);
- diff --git a/security/keys/proc.c b/security/keys/proc.c
- index bf08d02b6646..8d08def65fde 100644
- --- a/security/keys/proc.c
- +++ b/security/keys/proc.c
- @@ -229,7 +229,7 @@ static int proc_keys_show(struct seq_file *m, void *v)
- timo = key->expiry - now.tv_sec;
- if (timo < 60)
- - sprintf(xbuf, "%lus", timo);
- + sprintf(xbuf, "%us", (unsigned char)timo);
- else if (timo < 60*60)
- sprintf(xbuf, "%lum", timo / 60);
- else if (timo < 60*60*24)
- diff --git a/sound/isa/gus/gus_mem_proc.c b/sound/isa/gus/gus_mem_proc.c
- index 2ccb3fadd7be..019ef9422d52 100644
- --- a/sound/isa/gus/gus_mem_proc.c
- +++ b/sound/isa/gus/gus_mem_proc.c
- @@ -69,7 +69,7 @@ int snd_gf1_mem_proc_init(struct snd_gus_card * gus)
- if (priv == NULL)
- return -ENOMEM;
- priv->gus = gus;
- - sprintf(name, "gus-ram-%i", idx);
- + sprintf(name, "gus-ram-%hhi", idx);
- if (! snd_card_proc_new(gus->card, name, &entry)) {
- entry->content = SNDRV_INFO_CONTENT_DATA;
- entry->private_data = priv;
- @@ -87,7 +87,7 @@ int snd_gf1_mem_proc_init(struct snd_gus_card * gus)
- return -ENOMEM;
- priv->rom = 1;
- priv->gus = gus;
- - sprintf(name, "gus-rom-%i", idx);
- + sprintf(name, "gus-rom-%hhi", idx);
- if (! snd_card_proc_new(gus->card, name, &entry)) {
- entry->content = SNDRV_INFO_CONTENT_DATA;
- entry->private_data = priv;
- diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
- index 18e5ce81527d..a76ac83b22b1 100644
- --- a/sound/soc/fsl/fsl_sai.c
- +++ b/sound/soc/fsl/fsl_sai.c
- @@ -834,7 +834,7 @@ static int fsl_sai_probe(struct platform_device *pdev)
- sai->mclk_clk[0] = sai->bus_clk;
- for (i = 1; i < FSL_SAI_MCLK_MAX; i++) {
- - sprintf(tmp, "mclk%d", i);
- + sprintf(tmp, "mclk%hhd", i);
- sai->mclk_clk[i] = devm_clk_get(&pdev->dev, tmp);
- if (IS_ERR(sai->mclk_clk[i])) {
- dev_err(&pdev->dev, "failed to get mclk%d clock: %ld\n",
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement