Message ID | 20210504102648.88057-13-andriy.shevchenko@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | lib/string_helpers: get rid of ugly *_escape_mem_ascii() | expand |
Hi Andy,
I love your patch! Perhaps something to improve:
[auto build test WARNING on linux/master]
[also build test WARNING on linus/master nfsd/nfsd-next v5.12 next-20210504]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Andy-Shevchenko/lib-string_helpers-get-rid-of-ugly-_escape_mem_ascii/20210504-182828
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 1fe5501ba1abf2b7e78295df73675423bd6899a0
config: sparc-randconfig-p002-20210504 (attached as .config)
compiler: sparc-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/047508aa8c09cb58cf304e9025283021731b3921
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Andy-Shevchenko/lib-string_helpers-get-rid-of-ugly-_escape_mem_ascii/20210504-182828
git checkout 047508aa8c09cb58cf304e9025283021731b3921
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross W=1 ARCH=sparc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
In file included from drivers/atm/iphase.c:67:
>> drivers/atm/iphase.h:127: warning: "isprint" redefined
127 | #define isprint(a) ((a >=' ')&&(a <= '~'))
|
In file included from include/linux/string_helpers.h:6,
from include/linux/seq_file.h:7,
from include/linux/seq_file_net.h:5,
from include/net/net_namespace.h:188,
from include/linux/netdevice.h:37,
from include/net/sock.h:46,
from include/linux/atmdev.h:13,
from drivers/atm/iphase.c:49:
include/linux/ctype.h:30: note: this is the location of the previous definition
30 | #define isprint(c) ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0)
|
vim +/isprint +127 drivers/atm/iphase.h
^1da177e4c3f41 Linus Torvalds 2005-04-16 126
^1da177e4c3f41 Linus Torvalds 2005-04-16 @127 #define isprint(a) ((a >=' ')&&(a <= '~'))
^1da177e4c3f41 Linus Torvalds 2005-04-16 128 #define ATM_DESC(skb) (skb->protocol)
^1da177e4c3f41 Linus Torvalds 2005-04-16 129 #define IA_SKB_STATE(skb) (skb->protocol)
^1da177e4c3f41 Linus Torvalds 2005-04-16 130 #define IA_DLED 1
^1da177e4c3f41 Linus Torvalds 2005-04-16 131 #define IA_TX_DONE 2
^1da177e4c3f41 Linus Torvalds 2005-04-16 132
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Hi Andy,
I love your patch! Perhaps something to improve:
[auto build test WARNING on linux/master]
[also build test WARNING on linus/master v5.12 next-20210504]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Andy-Shevchenko/lib-string_helpers-get-rid-of-ugly-_escape_mem_ascii/20210504-182828
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 1fe5501ba1abf2b7e78295df73675423bd6899a0
config: s390-randconfig-r033-20210504 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8f5a2a5836cc8e4c1def2bdeb022e7b496623439)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install s390 cross compiling tool for clang build
# apt-get install binutils-s390x-linux-gnu
# https://github.com/0day-ci/linux/commit/047508aa8c09cb58cf304e9025283021731b3921
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Andy-Shevchenko/lib-string_helpers-get-rid-of-ugly-_escape_mem_ascii/20210504-182828
git checkout 047508aa8c09cb58cf304e9025283021731b3921
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=s390
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/tty/vt/selection.c:36:9: warning: 'isspace' macro redefined [-Wmacro-redefined]
#define isspace(c) ((c) == ' ')
^
include/linux/ctype.h:33:9: note: previous definition is here
#define isspace(c) ((__ismask(c)&(_S)) != 0)
^
1 warning generated.
vim +/isspace +36 drivers/tty/vt/selection.c
687bff0cd08f79 drivers/tty/vt/selection.c Jiri Slaby 2020-02-10 34
^1da177e4c3f41 drivers/char/selection.c Linus Torvalds 2005-04-16 35 /* Don't take this from <ctype.h>: 011-015 on the screen aren't spaces */
^1da177e4c3f41 drivers/char/selection.c Linus Torvalds 2005-04-16 @36 #define isspace(c) ((c) == ' ')
^1da177e4c3f41 drivers/char/selection.c Linus Torvalds 2005-04-16 37
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
On Tue, May 04, 2021 at 09:17:35PM +0800, kernel test robot wrote: > Hi Andy, > > I love your patch! Perhaps something to improve: > > [auto build test WARNING on linux/master] > [also build test WARNING on linus/master v5.12 next-20210504] > [If your patch is applied to the wrong git tree, kindly drop us a note. > And when submitting patch, we suggest to use '--base' as documented in > https://git-scm.com/docs/git-format-patch] > > url: https://github.com/0day-ci/linux/commits/Andy-Shevchenko/lib-string_helpers-get-rid-of-ugly-_escape_mem_ascii/20210504-182828 > base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 1fe5501ba1abf2b7e78295df73675423bd6899a0 > config: s390-randconfig-r033-20210504 (attached as .config) > compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8f5a2a5836cc8e4c1def2bdeb022e7b496623439) > reproduce (this is a W=1 build): > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > chmod +x ~/bin/make.cross > # install s390 cross compiling tool for clang build > # apt-get install binutils-s390x-linux-gnu > # https://github.com/0day-ci/linux/commit/047508aa8c09cb58cf304e9025283021731b3921 > git remote add linux-review https://github.com/0day-ci/linux > git fetch --no-tags linux-review Andy-Shevchenko/lib-string_helpers-get-rid-of-ugly-_escape_mem_ascii/20210504-182828 > git checkout 047508aa8c09cb58cf304e9025283021731b3921 > # save the attached .config to linux build tree > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=s390 > > If you fix the issue, kindly add following tag as appropriate > Reported-by: kernel test robot <lkp@intel.com> > > All warnings (new ones prefixed by >>): > > >> drivers/tty/vt/selection.c:36:9: warning: 'isspace' macro redefined [-Wmacro-redefined] > #define isspace(c) ((c) == ' ') Nice! Also for the rest of redefinitions... I'll prepare fixes.
Hi Andy, I love your patch! Yet something to improve: [auto build test ERROR on linux/master] [also build test ERROR on linus/master nfsd/nfsd-next v5.12 next-20210504] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Andy-Shevchenko/lib-string_helpers-get-rid-of-ugly-_escape_mem_ascii/20210504-182828 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 1fe5501ba1abf2b7e78295df73675423bd6899a0 config: powerpc64-randconfig-r035-20210504 (attached as .config) compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8f5a2a5836cc8e4c1def2bdeb022e7b496623439) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install powerpc64 cross compiling tool for clang build # apt-get install binutils-powerpc64-linux-gnu # https://github.com/0day-ci/linux/commit/047508aa8c09cb58cf304e9025283021731b3921 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Andy-Shevchenko/lib-string_helpers-get-rid-of-ugly-_escape_mem_ascii/20210504-182828 git checkout 047508aa8c09cb58cf304e9025283021731b3921 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=powerpc64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): In file included from arch/powerpc/kernel/prom_init.c:24: In file included from include/linux/pci.h:38: In file included from include/linux/interrupt.h:11: In file included from include/linux/hardirq.h:10: In file included from arch/powerpc/include/asm/hardirq.h:6: In file included from include/linux/irq.h:20: In file included from include/linux/io.h:13: In file included from arch/powerpc/include/asm/io.h:619: arch/powerpc/include/asm/io-defs.h:45:1: error: performing pointer arithmetic on a null pointer has undefined behavior [-Werror,-Wnull-pointer-arithmetic] DEF_PCI_AC_NORET(insw, (unsigned long p, void *b, unsigned long c), ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET' __do_##name al; \ ^~~~~~~~~~~~~~ <scratch space>:79:1: note: expanded from here __do_insw ^ arch/powerpc/include/asm/io.h:557:56: note: expanded from macro '__do_insw' #define __do_insw(p, b, n) readsw((PCI_IO_ADDR)_IO_BASE+(p), (b), (n)) ~~~~~~~~~~~~~~~~~~~~~^ In file included from arch/powerpc/kernel/prom_init.c:24: In file included from include/linux/pci.h:38: In file included from include/linux/interrupt.h:11: In file included from include/linux/hardirq.h:10: In file included from arch/powerpc/include/asm/hardirq.h:6: In file included from include/linux/irq.h:20: In file included from include/linux/io.h:13: In file included from arch/powerpc/include/asm/io.h:619: arch/powerpc/include/asm/io-defs.h:47:1: error: performing pointer arithmetic on a null pointer has undefined behavior [-Werror,-Wnull-pointer-arithmetic] DEF_PCI_AC_NORET(insl, (unsigned long p, void *b, unsigned long c), ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET' __do_##name al; \ ^~~~~~~~~~~~~~ <scratch space>:81:1: note: expanded from here __do_insl ^ arch/powerpc/include/asm/io.h:558:56: note: expanded from macro '__do_insl' #define __do_insl(p, b, n) readsl((PCI_IO_ADDR)_IO_BASE+(p), (b), (n)) ~~~~~~~~~~~~~~~~~~~~~^ In file included from arch/powerpc/kernel/prom_init.c:24: In file included from include/linux/pci.h:38: In file included from include/linux/interrupt.h:11: In file included from include/linux/hardirq.h:10: In file included from arch/powerpc/include/asm/hardirq.h:6: In file included from include/linux/irq.h:20: In file included from include/linux/io.h:13: In file included from arch/powerpc/include/asm/io.h:619: arch/powerpc/include/asm/io-defs.h:49:1: error: performing pointer arithmetic on a null pointer has undefined behavior [-Werror,-Wnull-pointer-arithmetic] DEF_PCI_AC_NORET(outsb, (unsigned long p, const void *b, unsigned long c), ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET' __do_##name al; \ ^~~~~~~~~~~~~~ <scratch space>:83:1: note: expanded from here __do_outsb ^ arch/powerpc/include/asm/io.h:559:58: note: expanded from macro '__do_outsb' #define __do_outsb(p, b, n) writesb((PCI_IO_ADDR)_IO_BASE+(p),(b),(n)) ~~~~~~~~~~~~~~~~~~~~~^ In file included from arch/powerpc/kernel/prom_init.c:24: In file included from include/linux/pci.h:38: In file included from include/linux/interrupt.h:11: In file included from include/linux/hardirq.h:10: In file included from arch/powerpc/include/asm/hardirq.h:6: In file included from include/linux/irq.h:20: In file included from include/linux/io.h:13: In file included from arch/powerpc/include/asm/io.h:619: arch/powerpc/include/asm/io-defs.h:51:1: error: performing pointer arithmetic on a null pointer has undefined behavior [-Werror,-Wnull-pointer-arithmetic] DEF_PCI_AC_NORET(outsw, (unsigned long p, const void *b, unsigned long c), ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET' __do_##name al; \ ^~~~~~~~~~~~~~ <scratch space>:85:1: note: expanded from here __do_outsw ^ arch/powerpc/include/asm/io.h:560:58: note: expanded from macro '__do_outsw' #define __do_outsw(p, b, n) writesw((PCI_IO_ADDR)_IO_BASE+(p),(b),(n)) ~~~~~~~~~~~~~~~~~~~~~^ In file included from arch/powerpc/kernel/prom_init.c:24: In file included from include/linux/pci.h:38: In file included from include/linux/interrupt.h:11: In file included from include/linux/hardirq.h:10: In file included from arch/powerpc/include/asm/hardirq.h:6: In file included from include/linux/irq.h:20: In file included from include/linux/io.h:13: In file included from arch/powerpc/include/asm/io.h:619: arch/powerpc/include/asm/io-defs.h:53:1: error: performing pointer arithmetic on a null pointer has undefined behavior [-Werror,-Wnull-pointer-arithmetic] DEF_PCI_AC_NORET(outsl, (unsigned long p, const void *b, unsigned long c), ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET' __do_##name al; \ ^~~~~~~~~~~~~~ <scratch space>:87:1: note: expanded from here __do_outsl ^ arch/powerpc/include/asm/io.h:561:58: note: expanded from macro '__do_outsl' #define __do_outsl(p, b, n) writesl((PCI_IO_ADDR)_IO_BASE+(p),(b),(n)) ~~~~~~~~~~~~~~~~~~~~~^ >> arch/powerpc/kernel/prom_init.c:704:9: error: 'isxdigit' macro redefined [-Werror,-Wmacro-redefined] #define isxdigit(c) (('0' <= (c) && (c) <= '9') \ ^ include/linux/ctype.h:35:9: note: previous definition is here #define isxdigit(c) ((__ismask(c)&(_D|_X)) != 0) ^ >> arch/powerpc/kernel/prom_init.c:709:9: error: 'islower' macro redefined [-Werror,-Wmacro-redefined] #define islower(c) ('a' <= (c) && (c) <= 'z') ^ include/linux/ctype.h:29:9: note: previous definition is here #define islower(c) ((__ismask(c)&(_L)) != 0) ^ >> arch/powerpc/kernel/prom_init.c:710:9: error: 'toupper' macro redefined [-Werror,-Wmacro-redefined] #define toupper(c) (islower(c) ? ((c) - 'a' + 'A') : (c)) ^ include/linux/ctype.h:64:9: note: previous definition is here #define toupper(c) __toupper(c) ^ 9 errors generated. vim +/isxdigit +704 arch/powerpc/kernel/prom_init.c 9b6b563c0d2d25 Paul Mackerras 2005-10-06 702 5827d4165ac608 Anton Blanchard 2012-11-26 703 /* We can't use the standard versions because of relocation headaches. */ cf68787b68a201 Benjamin Krill 2009-07-27 @704 #define isxdigit(c) (('0' <= (c) && (c) <= '9') \ cf68787b68a201 Benjamin Krill 2009-07-27 705 || ('a' <= (c) && (c) <= 'f') \ cf68787b68a201 Benjamin Krill 2009-07-27 706 || ('A' <= (c) && (c) <= 'F')) cf68787b68a201 Benjamin Krill 2009-07-27 707 cf68787b68a201 Benjamin Krill 2009-07-27 708 #define isdigit(c) ('0' <= (c) && (c) <= '9') cf68787b68a201 Benjamin Krill 2009-07-27 @709 #define islower(c) ('a' <= (c) && (c) <= 'z') cf68787b68a201 Benjamin Krill 2009-07-27 @710 #define toupper(c) (islower(c) ? ((c) - 'a' + 'A') : (c)) cf68787b68a201 Benjamin Krill 2009-07-27 711 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
On Tue, May 04, 2021 at 01:26:46PM +0300, Andy Shevchenko wrote: > Convert seq_escape() to use seq_escape_mem() rather than using > a separate symbol. At the same time move it to header as inliner. Seems making it an inliner opened a can of worms. So, for now, I will drop that part from the series, while keeping fixes in my tree for the issues that have been reported by LKP.
diff --git a/fs/seq_file.c b/fs/seq_file.c index 532cac2eae0f..d78801403a2f 100644 --- a/fs/seq_file.c +++ b/fs/seq_file.c @@ -380,27 +380,6 @@ void seq_escape_mem(struct seq_file *m, const char *src, size_t len, } EXPORT_SYMBOL(seq_escape_mem); -/** - * seq_escape - print string into buffer, escaping some characters - * @m: target buffer - * @s: string - * @esc: set of characters that need escaping - * - * Puts string into buffer, replacing each occurrence of character from - * @esc with usual octal escape. - * Use seq_has_overflowed() to check for errors. - */ -void seq_escape(struct seq_file *m, const char *s, const char *esc) -{ - char *buf; - size_t size = seq_get_buf(m, &buf); - int ret; - - ret = string_escape_str(s, buf, size, ESCAPE_OCTAL, esc); - seq_commit(m, ret < size ? ret : -1); -} -EXPORT_SYMBOL(seq_escape); - void seq_escape_mem_ascii(struct seq_file *m, const char *src, size_t isz) { char *buf; diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h index 6de442182784..0b3a6096bed3 100644 --- a/include/linux/seq_file.h +++ b/include/linux/seq_file.h @@ -4,6 +4,7 @@ #include <linux/types.h> #include <linux/string.h> +#include <linux/string_helpers.h> #include <linux/bug.h> #include <linux/mutex.h> #include <linux/cpumask.h> @@ -128,7 +129,23 @@ void seq_put_hex_ll(struct seq_file *m, const char *delimiter, void seq_escape_mem(struct seq_file *m, const char *src, size_t len, unsigned int flags, const char *esc); -void seq_escape(struct seq_file *m, const char *s, const char *esc); + +/** + * seq_escape - print string into buffer, escaping some characters + * @m: target buffer + * @s: NULL-terminated string + * @esc: set of characters that need escaping + * + * Puts string into buffer, replacing each occurrence of character from + * @esc with usual octal escape. + * + * Use seq_has_overflowed() to check for errors. + */ +static inline void seq_escape(struct seq_file *m, const char *s, const char *esc) +{ + seq_escape_mem(m, s, strlen(s), ESCAPE_OCTAL, esc); +} + void seq_escape_mem_ascii(struct seq_file *m, const char *src, size_t isz); void seq_hex_dump(struct seq_file *m, const char *prefix_str, int prefix_type,
Convert seq_escape() to use seq_escape_mem() rather than using a separate symbol. At the same time move it to header as inliner. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- fs/seq_file.c | 21 --------------------- include/linux/seq_file.h | 19 ++++++++++++++++++- 2 files changed, 18 insertions(+), 22 deletions(-)