Advertisement
Guest User

Untitled

a guest
Aug 20th, 2017
590
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.60 KB | None | 0 0
  1. From 8ecb54080f9bfe2232d788a455be8a6617c2c838 Mon Sep 17 00:00:00 2001
  2. From: Arnd Bergmann <[email protected]>
  3. Date: Fri, 28 Jul 2017 11:48:19 +0200
  4. Subject: [PATCH] shut up more -Wformat-overflow warnings
  5.  
  6. This seems to be a false-positive coming from a bad gcc optimization step:
  7.  
  8. security/keys/proc.c: In function 'proc_keys_show':
  9. security/keys/proc.c:232:19: error: '%lu' directive writing between 1 and 20 bytes into a region of size 16 [-Werror=format-overflow=]
  10.  
  11. sound/soc/fsl/fsl_sai.c: In function 'fsl_sai_probe':
  12. 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=]
  13.  
  14. drivers/block/cciss.c: In function 'cciss_init_one':
  15. drivers/block/cciss.c:5039:28: error: '%d' directive writing between 1 and 10 bytes into a region of size 3 [-Werror=format-overflow=]
  16.  
  17. sound/isa/gus/gus_mem_proc.c: In function 'snd_gf1_mem_proc_init':
  18. 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=]
  19. sprintf(name, "gus-ram-%i", idx);
  20. ^~
  21. sound/isa/gus/gus_mem_proc.c:72:18: note: directive argument in the range [0, 2147483646]
  22. sprintf(name, "gus-ram-%i", idx);
  23. ^~~~~~~~~~~~
  24. sound/isa/gus/gus_mem_proc.c:72:4: note: 'sprintf' output between 10 and 19 bytes into a destination of size 16
  25. sprintf(name, "gus-ram-%i", idx);
  26.  
  27. drivers/net/ethernet/marvell/mvneta_bm.c: In function 'mvneta_bm_probe':
  28. 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=]
  29. sprintf(prop, "pool%d,capacity", i);
  30. ^~~~~~~~~~~~~~~~~
  31. drivers/net/ethernet/marvell/mvneta_bm.c:306:3: note: 'sprintf' output between 15 and 24 bytes into a destination of size 15
  32. sprintf(prop, "pool%d,capacity", i);
  33.  
  34. drivers/pnp/pnpbios/proc.c: In function 'pnpbios_proc_exit':
  35. 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=]
  36. sprintf(name, "%02x", i);
  37. ^~~~
  38. drivers/pnp/pnpbios/proc.c:338:17: note: directive argument in the range [0, 2147483646]
  39. sprintf(name, "%02x", i);
  40. ^~~~~~
  41. drivers/pnp/pnpbios/proc.c:338:3: note: 'sprintf' output between 3 and 9 bytes into a destination of size 3
  42.  
  43. drivers/mfd/max77620.c: In function 'max77620_probe':
  44. drivers/mfd/max77620.c:282:25: error: '%d' directive writing between 1 and 10 bytes into a region of size 7 [-Werror=format-overflow=]
  45. sprintf(fps_name, fps%d, fps_id);
  46. ^~
  47. drivers/mfd/max77620.c:282:21: note: directive argument in the range [0, 2147483646]
  48. sprintf(fps_name, fps%d, fps_id);
  49. ^~~~~~~
  50. drivers/mfd/max77620.c:282:3: note: 'sprintf' output between 5 and 14 bytes into a destination of size 10
  51. sprintf(fps_name, fps%d, fps_id);
  52.  
  53. Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81592
  54. Signed-off-by: Arnd Bergmann <[email protected]>
  55.  
  56. diff --git a/drivers/mfd/max77620.c b/drivers/mfd/max77620.c
  57. index b1700b5fa640..7569d2387de5 100644
  58. --- a/drivers/mfd/max77620.c
  59. +++ b/drivers/mfd/max77620.c
  60. @@ -279,7 +279,7 @@ static int max77620_config_fps(struct max77620_chip *chip,
  61. }
  62.  
  63. for (fps_id = 0; fps_id < MAX77620_FPS_COUNT; fps_id++) {
  64. - sprintf(fps_name, "fps%d", fps_id);
  65. + sprintf(fps_name, "fps%hhd", fps_id);
  66. if (!strcmp(fps_np->name, fps_name))
  67. break;
  68. }
  69. diff --git a/drivers/net/ethernet/marvell/mvneta_bm.c b/drivers/net/ethernet/marvell/mvneta_bm.c
  70. index 466939f8f0cf..51473c4d8b8c 100644
  71. --- a/drivers/net/ethernet/marvell/mvneta_bm.c
  72. +++ b/drivers/net/ethernet/marvell/mvneta_bm.c
  73. @@ -303,22 +303,22 @@ static void mvneta_bm_pools_init(struct mvneta_bm *priv)
  74. mvneta_bm_write(priv, MVNETA_BM_POOL_WRITE_PTR_REG(i), 0);
  75.  
  76. /* Configure pool size according to DT or use default value */
  77. - sprintf(prop, "pool%d,capacity", i);
  78. + snprintf(prop, sizeof(prop), "pool%hhd,capacity", i);
  79. if (of_property_read_u32(dn, prop, &size)) {
  80. size = MVNETA_BM_POOL_CAP_DEF;
  81. } else if (size > MVNETA_BM_POOL_CAP_MAX) {
  82. dev_warn(&priv->pdev->dev,
  83. - "Illegal pool %d capacity %d, set to %d\n",
  84. + "Illegal pool %hhd capacity %d, set to %d\n",
  85. i, size, MVNETA_BM_POOL_CAP_MAX);
  86. size = MVNETA_BM_POOL_CAP_MAX;
  87. } else if (size < MVNETA_BM_POOL_CAP_MIN) {
  88. dev_warn(&priv->pdev->dev,
  89. - "Illegal pool %d capacity %d, set to %d\n",
  90. + "Illegal pool %hhd capacity %d, set to %d\n",
  91. i, size, MVNETA_BM_POOL_CAP_MIN);
  92. size = MVNETA_BM_POOL_CAP_MIN;
  93. } else if (!IS_ALIGNED(size, MVNETA_BM_POOL_CAP_ALIGN)) {
  94. dev_warn(&priv->pdev->dev,
  95. - "Illegal pool %d capacity %d, round to %d\n",
  96. + "Illegal pool %hhd capacity %d, round to %d\n",
  97. i, size, ALIGN(size,
  98. MVNETA_BM_POOL_CAP_ALIGN));
  99. size = ALIGN(size, MVNETA_BM_POOL_CAP_ALIGN);
  100. @@ -329,7 +329,7 @@ static void mvneta_bm_pools_init(struct mvneta_bm *priv)
  101. bm_pool->hwbm_pool.size);
  102.  
  103. /* Obtain custom pkt_size from DT */
  104. - sprintf(prop, "pool%d,pkt-size", i);
  105. + snprintf(prop, sizeof(prop), "pool%hhd,pkt-size", i);
  106. if (of_property_read_u32(dn, prop, &bm_pool->pkt_size))
  107. bm_pool->pkt_size = 0;
  108. }
  109. diff --git a/drivers/pnp/pnpbios/proc.c b/drivers/pnp/pnpbios/proc.c
  110. index 5ee6b2a5f8d5..2b1c9df27bbb 100644
  111. --- a/drivers/pnp/pnpbios/proc.c
  112. +++ b/drivers/pnp/pnpbios/proc.c
  113. @@ -335,7 +335,7 @@ void __exit pnpbios_proc_exit(void)
  114. return;
  115.  
  116. for (i = 0; i < 0xff; i++) {
  117. - sprintf(name, "%02x", i);
  118. + snprintf(name, sizeof(name), "%02hhx", i);
  119. if (!pnpbios_dont_use_current_config)
  120. remove_proc_entry(name, proc_pnp);
  121. remove_proc_entry(name, proc_pnp_boot);
  122. diff --git a/security/keys/proc.c b/security/keys/proc.c
  123. index bf08d02b6646..8d08def65fde 100644
  124. --- a/security/keys/proc.c
  125. +++ b/security/keys/proc.c
  126. @@ -229,7 +229,7 @@ static int proc_keys_show(struct seq_file *m, void *v)
  127. timo = key->expiry - now.tv_sec;
  128.  
  129. if (timo < 60)
  130. - sprintf(xbuf, "%lus", timo);
  131. + sprintf(xbuf, "%us", (unsigned char)timo);
  132. else if (timo < 60*60)
  133. sprintf(xbuf, "%lum", timo / 60);
  134. else if (timo < 60*60*24)
  135. diff --git a/sound/isa/gus/gus_mem_proc.c b/sound/isa/gus/gus_mem_proc.c
  136. index 2ccb3fadd7be..019ef9422d52 100644
  137. --- a/sound/isa/gus/gus_mem_proc.c
  138. +++ b/sound/isa/gus/gus_mem_proc.c
  139. @@ -69,7 +69,7 @@ int snd_gf1_mem_proc_init(struct snd_gus_card * gus)
  140. if (priv == NULL)
  141. return -ENOMEM;
  142. priv->gus = gus;
  143. - sprintf(name, "gus-ram-%i", idx);
  144. + sprintf(name, "gus-ram-%hhi", idx);
  145. if (! snd_card_proc_new(gus->card, name, &entry)) {
  146. entry->content = SNDRV_INFO_CONTENT_DATA;
  147. entry->private_data = priv;
  148. @@ -87,7 +87,7 @@ int snd_gf1_mem_proc_init(struct snd_gus_card * gus)
  149. return -ENOMEM;
  150. priv->rom = 1;
  151. priv->gus = gus;
  152. - sprintf(name, "gus-rom-%i", idx);
  153. + sprintf(name, "gus-rom-%hhi", idx);
  154. if (! snd_card_proc_new(gus->card, name, &entry)) {
  155. entry->content = SNDRV_INFO_CONTENT_DATA;
  156. entry->private_data = priv;
  157. diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
  158. index 18e5ce81527d..a76ac83b22b1 100644
  159. --- a/sound/soc/fsl/fsl_sai.c
  160. +++ b/sound/soc/fsl/fsl_sai.c
  161. @@ -834,7 +834,7 @@ static int fsl_sai_probe(struct platform_device *pdev)
  162.  
  163. sai->mclk_clk[0] = sai->bus_clk;
  164. for (i = 1; i < FSL_SAI_MCLK_MAX; i++) {
  165. - sprintf(tmp, "mclk%d", i);
  166. + sprintf(tmp, "mclk%hhd", i);
  167. sai->mclk_clk[i] = devm_clk_get(&pdev->dev, tmp);
  168. if (IS_ERR(sai->mclk_clk[i])) {
  169. dev_err(&pdev->dev, "failed to get mclk%d clock: %ld\n",
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement