diff options
Diffstat (limited to 'meta-oe/recipes-extended/socketcan/libsocketcan/0001-Use-strcmp-instead-of-sizeof-on-char-string.patch')
-rw-r--r-- | meta-oe/recipes-extended/socketcan/libsocketcan/0001-Use-strcmp-instead-of-sizeof-on-char-string.patch | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/meta-oe/recipes-extended/socketcan/libsocketcan/0001-Use-strcmp-instead-of-sizeof-on-char-string.patch b/meta-oe/recipes-extended/socketcan/libsocketcan/0001-Use-strcmp-instead-of-sizeof-on-char-string.patch new file mode 100644 index 0000000000..aa6196ee90 --- /dev/null +++ b/meta-oe/recipes-extended/socketcan/libsocketcan/0001-Use-strcmp-instead-of-sizeof-on-char-string.patch | |||
@@ -0,0 +1,39 @@ | |||
1 | From 94094cc4ee7ae585da3e5e7e83e7d82b5d6de656 Mon Sep 17 00:00:00 2001 | ||
2 | From: Alexander Stein <alexander.stein@systec-electronic.com> | ||
3 | Date: Wed, 14 Nov 2012 12:13:06 +0100 | ||
4 | Subject: [PATCH] Use strcmp instead of sizeof on char* string | ||
5 | |||
6 | This bug was detected by the clang warning: | ||
7 | libsocketcan.c:384:16: warning: argument to 'sizeof' in 'strncmp' call | ||
8 | is the same expression as the source; did you mean to provide an | ||
9 | explicit length? [-Wsizeof-pointer-memaccess] | ||
10 | sizeof(name)) != 0) | ||
11 | ~~~~~~~^~~~~~ | ||
12 | |||
13 | Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com> | ||
14 | Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> | ||
15 | --- | ||
16 | Upstream-Status: Backport | ||
17 | |||
18 | src/libsocketcan.c | 5 ++--- | ||
19 | 1 file changed, 2 insertions(+), 3 deletions(-) | ||
20 | |||
21 | diff --git a/src/libsocketcan.c b/src/libsocketcan.c | ||
22 | index fedcbdc..841c2ed 100644 | ||
23 | --- a/src/libsocketcan.c | ||
24 | +++ b/src/libsocketcan.c | ||
25 | @@ -379,9 +379,8 @@ static int do_get_nl_link(int fd, __u8 acquire, const char *name, void *res) | ||
26 | nl_msg->nlmsg_len - NLMSG_LENGTH(sizeof(struct ifaddrmsg)); | ||
27 | parse_rtattr(tb, IFLA_MAX, IFLA_RTA(ifi), len); | ||
28 | |||
29 | - if (strncmp | ||
30 | - ((char *)RTA_DATA(tb[IFLA_IFNAME]), name, | ||
31 | - sizeof(name)) != 0) | ||
32 | + if (strcmp | ||
33 | + ((char *)RTA_DATA(tb[IFLA_IFNAME]), name) != 0) | ||
34 | continue; | ||
35 | |||
36 | if (tb[IFLA_LINKINFO]) | ||
37 | -- | ||
38 | 1.8.3.1 | ||
39 | |||