Skip to contentSkip to conversation

backports: backport-3.15: Include fix

PATCH Superseded Richard Röjfors 2 participants 2 messages May 3, 2014 – Jun 1, 2014

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 backports: backport-3.15: Include fix

Include string.h to avoid compile issues if warnings are treated as errors:

backports-3.14-1/compat/backport-3.15.c: In function 'backport_devm_kstrdup':
backports-3.14-1/compat/backport-3.15.c:33:2: error: implicit declaration of function 'strlen' [-Werror=implicit-function-declaration]
size = strlen(s) + 1;
^
backports-3.14-1/compat/backport-3.15.c:33:9: warning: incompatible implicit declaration of built-in function 'strlen' [enabled by default]

   size = strlen(s) + 1;
          ^
backports-3.14-1/compat/backport-3.15.c:36:3: error: implicit declaration of function 'memcpy' [-Werror=implicit-function-declaration]
    memcpy(buf, s, size);
    ^

backports-3.14-1/compat/backport-3.15.c:36:3: warning: incompatible implicit declaration of built-in function 'memcpy' [enabled by default]

---

compat/backport-3.15.c +1 -0
@@ -11,6 +11,7 @@
 #include <linux/kernel.h>
 #include <linux/device.h>
 #include <linux/of.h>
+#include <string.h>
 
 /**
  * devm_kstrdup - Allocate resource managed space and
#1 lore raw
Quoted 19 lines · Richard Röjfors

Include string.h to avoid compile issues if warnings are treated as errors:

backports-3.14-1/compat/backport-3.15.c: In function 'backport_devm_kstrdup':
backports-3.14-1/compat/backport-3.15.c:33:2: error: implicit declaration of function 'strlen' [-Werror=implicit-function-declaration]

   size = strlen(s) + 1;
   ^
backports-3.14-1/compat/backport-3.15.c:33:9: warning: incompatible implicit declaration of built-in function 'strlen' [enabled by default]
   size = strlen(s) + 1;
          ^
backports-3.14-1/compat/backport-3.15.c:36:3: error: implicit declaration of function 'memcpy' [-Werror=implicit-function-declaration]
    memcpy(buf, s, size);
    ^

backports-3.14-1/compat/backport-3.15.c:36:3: warning: incompatible implicit declaration of built-in function 'memcpy' [enabled by default]

---

compat/backport-3.15.c line 17

Quoted 7 lines
compat/backport-3.15.c +1 -0
@@ -11,6 +11,7 @@
 #include <linux/kernel.h>
 #include <linux/device.h>
 #include <linux/of.h>
+#include <string.h>
 
 /**
  * devm_kstrdup - Allocate resource managed space and

Thank you for the patch, is was applied, pushed and is included in the backports-20140501 release.

Next time you should base your patch on top of the git repository at [0] and on the mater branch and no some release branch.

Hauke

[0]: https://git.kernel.org/cgit/linux/kernel/git/backports/backports.git/