linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tools: Fix bccmd build with GCC 4.9
@ 2014-04-02 20:15 Szymon Janc
  2014-04-03  7:20 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Szymon Janc @ 2014-04-02 20:15 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

Make sure accessing array[63 * 2 + 4] is legal.

tools/bccmd.c: In function ‘cmd_buildname’:
tools/bccmd.c:406:18: error: iteration 63u invokes undefined behavior
     [-Werror=aggressive-loop-optimizations]
   name[i] = array[(i * 2) + 4];
---
 tools/bccmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/bccmd.c b/tools/bccmd.c
index ff1b307..4649ad5 100644
--- a/tools/bccmd.c
+++ b/tools/bccmd.c
@@ -389,7 +389,7 @@ static int cmd_chiprev(int transport, int argc, char *argv[])
 
 static int cmd_buildname(int transport, int argc, char *argv[])
 {
-	uint8_t array[130];
+	uint8_t array[131];
 	char name[64];
 	unsigned int i;
 	int err;
-- 
1.9.1


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

* Re: [PATCH] tools: Fix bccmd build with GCC 4.9
  2014-04-02 20:15 [PATCH] tools: Fix bccmd build with GCC 4.9 Szymon Janc
@ 2014-04-03  7:20 ` Johan Hedberg
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2014-04-03  7:20 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth

Hi Szymon,

On Wed, Apr 02, 2014, Szymon Janc wrote:
> Make sure accessing array[63 * 2 + 4] is legal.
> 
> tools/bccmd.c: In function ‘cmd_buildname’:
> tools/bccmd.c:406:18: error: iteration 63u invokes undefined behavior
>      [-Werror=aggressive-loop-optimizations]
>    name[i] = array[(i * 2) + 4];
> ---
>  tools/bccmd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied. Thanks.

Johan

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

end of thread, other threads:[~2014-04-03  7:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-02 20:15 [PATCH] tools: Fix bccmd build with GCC 4.9 Szymon Janc
2014-04-03  7:20 ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).