]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.4/isdn-avm-fix-string-plus-integer-warning-from-clang.patch
Linux 3.18.137
[thirdparty/kernel/stable-queue.git] / queue-4.4 / isdn-avm-fix-string-plus-integer-warning-from-clang.patch
1 From 89d5f008f80bda7e978809270c414952d2e689e2 Mon Sep 17 00:00:00 2001
2 From: Nathan Chancellor <natechancellor@gmail.com>
3 Date: Wed, 9 Jan 2019 22:41:08 -0700
4 Subject: isdn: avm: Fix string plus integer warning from Clang
5
6 [ Upstream commit 7afa81c55fca0cad589722cb4bce698b4803b0e1 ]
7
8 A recent commit in Clang expanded the -Wstring-plus-int warning, showing
9 some odd behavior in this file.
10
11 drivers/isdn/hardware/avm/b1.c:426:30: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
12 cinfo->version[j] = "\0\0" + 1;
13 ~~~~~~~^~~
14 drivers/isdn/hardware/avm/b1.c:426:30: note: use array indexing to silence this warning
15 cinfo->version[j] = "\0\0" + 1;
16 ^
17 & [ ]
18 1 warning generated.
19
20 This is equivalent to just "\0". Nick pointed out that it is smarter to
21 use "" instead of "\0" because "" is used elsewhere in the kernel and
22 can be deduplicated at the linking stage.
23
24 Link: https://github.com/ClangBuiltLinux/linux/issues/309
25 Suggested-by: Nick Desaulniers <ndesaulniers@google.com>
26 Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
27 Signed-off-by: David S. Miller <davem@davemloft.net>
28 Signed-off-by: Sasha Levin <sashal@kernel.org>
29 ---
30 drivers/isdn/hardware/avm/b1.c | 2 +-
31 1 file changed, 1 insertion(+), 1 deletion(-)
32
33 diff --git a/drivers/isdn/hardware/avm/b1.c b/drivers/isdn/hardware/avm/b1.c
34 index 4d9b195547c5c..df2a10157720a 100644
35 --- a/drivers/isdn/hardware/avm/b1.c
36 +++ b/drivers/isdn/hardware/avm/b1.c
37 @@ -423,7 +423,7 @@ void b1_parse_version(avmctrl_info *cinfo)
38 int i, j;
39
40 for (j = 0; j < AVM_MAXVERSION; j++)
41 - cinfo->version[j] = "\0\0" + 1;
42 + cinfo->version[j] = "";
43 for (i = 0, j = 0;
44 j < AVM_MAXVERSION && i < cinfo->versionlen;
45 j++, i += cinfo->versionbuf[i] + 1)
46 --
47 2.19.1
48