Re: [PATCH] scsi: avoid a double-fetch and a redundant copy

From: kbuild test robot
Date: Tue Dec 25 2018 - 16:29:20 EST


Hi Kangjie,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on scsi/for-next]
[also build test WARNING on v4.20 next-20181224]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Kangjie-Lu/scsi-avoid-a-double-fetch-and-a-redundant-copy/20181226-042018
base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: m68k-allmodconfig (attached as .config)
compiler: m68k-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=m68k

All warnings (new ones prefixed by >>):

In file included from arch/m68k/include/asm/uaccess.h:5:0,
from include/linux/uaccess.h:14,
from include/linux/poll.h:12,
from drivers/scsi/sg.c:42:
drivers/scsi/sg.c: In function 'sg_read':
drivers/scsi/sg.c:450:27: error: request for member 'pack_id' in something not a structure or union
&((sg_io_hdr_t *)buf->pack_id));
^
arch/m68k/include/asm/uaccess_mm.h:134:19: note: in definition of macro '__get_user'
switch (sizeof(*(ptr))) { \
^~~
drivers/scsi/sg.c:449:14: note: in expansion of macro 'get_user'
retval = get_user(req_pack_id,
^~~~~~~~
drivers/scsi/sg.c:450:27: error: request for member 'pack_id' in something not a structure or union
&((sg_io_hdr_t *)buf->pack_id));
^
arch/m68k/include/asm/uaccess_mm.h:126:12: note: in definition of macro '__get_user_asm'
: "m" (*(ptr)), "i" (err)); \
^~~
>> arch/m68k/include/asm/uaccess_mm.h:180:26: note: in expansion of macro '__get_user'
#define get_user(x, ptr) __get_user(x, ptr)
^~~~~~~~~~
drivers/scsi/sg.c:449:14: note: in expansion of macro 'get_user'
retval = get_user(req_pack_id,
^~~~~~~~
drivers/scsi/sg.c:450:27: error: request for member 'pack_id' in something not a structure or union
&((sg_io_hdr_t *)buf->pack_id));
^
arch/m68k/include/asm/uaccess_mm.h:127:26: note: in definition of macro '__get_user_asm'
(x) = (__force typeof(*(ptr)))(__force unsigned long)__gu_val; \
^~~
>> arch/m68k/include/asm/uaccess_mm.h:180:26: note: in expansion of macro '__get_user'
#define get_user(x, ptr) __get_user(x, ptr)
^~~~~~~~~~
drivers/scsi/sg.c:449:14: note: in expansion of macro 'get_user'
retval = get_user(req_pack_id,
^~~~~~~~
drivers/scsi/sg.c:450:27: error: request for member 'pack_id' in something not a structure or union
&((sg_io_hdr_t *)buf->pack_id));
^
arch/m68k/include/asm/uaccess_mm.h:126:12: note: in definition of macro '__get_user_asm'
: "m" (*(ptr)), "i" (err)); \
^~~
>> arch/m68k/include/asm/uaccess_mm.h:180:26: note: in expansion of macro '__get_user'
#define get_user(x, ptr) __get_user(x, ptr)
^~~~~~~~~~
drivers/scsi/sg.c:449:14: note: in expansion of macro 'get_user'
retval = get_user(req_pack_id,
^~~~~~~~
drivers/scsi/sg.c:450:27: error: request for member 'pack_id' in something not a structure or union
&((sg_io_hdr_t *)buf->pack_id));
^
arch/m68k/include/asm/uaccess_mm.h:127:26: note: in definition of macro '__get_user_asm'
(x) = (__force typeof(*(ptr)))(__force unsigned long)__gu_val; \
^~~
>> arch/m68k/include/asm/uaccess_mm.h:180:26: note: in expansion of macro '__get_user'
#define get_user(x, ptr) __get_user(x, ptr)
^~~~~~~~~~
drivers/scsi/sg.c:449:14: note: in expansion of macro 'get_user'
retval = get_user(req_pack_id,
^~~~~~~~
drivers/scsi/sg.c:450:27: error: request for member 'pack_id' in something not a structure or union
&((sg_io_hdr_t *)buf->pack_id));
^
arch/m68k/include/asm/uaccess_mm.h:126:12: note: in definition of macro '__get_user_asm'
: "m" (*(ptr)), "i" (err)); \
^~~
>> arch/m68k/include/asm/uaccess_mm.h:180:26: note: in expansion of macro '__get_user'
#define get_user(x, ptr) __get_user(x, ptr)
^~~~~~~~~~
drivers/scsi/sg.c:449:14: note: in expansion of macro 'get_user'
retval = get_user(req_pack_id,
^~~~~~~~
drivers/scsi/sg.c:450:27: error: request for member 'pack_id' in something not a structure or union
&((sg_io_hdr_t *)buf->pack_id));
^
arch/m68k/include/asm/uaccess_mm.h:127:26: note: in definition of macro '__get_user_asm'
(x) = (__force typeof(*(ptr)))(__force unsigned long)__gu_val; \
^~~
>> arch/m68k/include/asm/uaccess_mm.h:180:26: note: in expansion of macro '__get_user'
#define get_user(x, ptr) __get_user(x, ptr)
^~~~~~~~~~
drivers/scsi/sg.c:449:14: note: in expansion of macro 'get_user'
retval = get_user(req_pack_id,
^~~~~~~~
drivers/scsi/sg.c:450:27: error: request for member 'pack_id' in something not a structure or union
&((sg_io_hdr_t *)buf->pack_id));
^
arch/m68k/include/asm/uaccess_mm.h:145:27: note: in definition of macro '__get_user'
const void *__gu_ptr = (ptr); \
^~~
drivers/scsi/sg.c:449:14: note: in expansion of macro 'get_user'
retval = get_user(req_pack_id,
^~~~~~~~
drivers/scsi/sg.c:450:27: error: request for member 'pack_id' in something not a structure or union
&((sg_io_hdr_t *)buf->pack_id));
^
arch/m68k/include/asm/uaccess_mm.h:148:17: note: in definition of macro '__get_user'
__typeof__(*(ptr)) t; \
^~~
drivers/scsi/sg.c:449:14: note: in expansion of macro 'get_user'
retval = get_user(req_pack_id,
^~~~~~~~
--
In file included from arch/m68k/include/asm/uaccess.h:5:0,
from include/linux/uaccess.h:14,
from include/linux/poll.h:12,
from drivers//scsi/sg.c:42:
drivers//scsi/sg.c: In function 'sg_read':
drivers//scsi/sg.c:450:27: error: request for member 'pack_id' in something not a structure or union
&((sg_io_hdr_t *)buf->pack_id));
^
arch/m68k/include/asm/uaccess_mm.h:134:19: note: in definition of macro '__get_user'
switch (sizeof(*(ptr))) { \
^~~
drivers//scsi/sg.c:449:14: note: in expansion of macro 'get_user'
retval = get_user(req_pack_id,
^~~~~~~~
drivers//scsi/sg.c:450:27: error: request for member 'pack_id' in something not a structure or union
&((sg_io_hdr_t *)buf->pack_id));
^
arch/m68k/include/asm/uaccess_mm.h:126:12: note: in definition of macro '__get_user_asm'
: "m" (*(ptr)), "i" (err)); \
^~~
>> arch/m68k/include/asm/uaccess_mm.h:180:26: note: in expansion of macro '__get_user'
#define get_user(x, ptr) __get_user(x, ptr)
^~~~~~~~~~
drivers//scsi/sg.c:449:14: note: in expansion of macro 'get_user'
retval = get_user(req_pack_id,
^~~~~~~~
drivers//scsi/sg.c:450:27: error: request for member 'pack_id' in something not a structure or union
&((sg_io_hdr_t *)buf->pack_id));
^
arch/m68k/include/asm/uaccess_mm.h:127:26: note: in definition of macro '__get_user_asm'
(x) = (__force typeof(*(ptr)))(__force unsigned long)__gu_val; \
^~~
>> arch/m68k/include/asm/uaccess_mm.h:180:26: note: in expansion of macro '__get_user'
#define get_user(x, ptr) __get_user(x, ptr)
^~~~~~~~~~
drivers//scsi/sg.c:449:14: note: in expansion of macro 'get_user'
retval = get_user(req_pack_id,
^~~~~~~~
drivers//scsi/sg.c:450:27: error: request for member 'pack_id' in something not a structure or union
&((sg_io_hdr_t *)buf->pack_id));
^
arch/m68k/include/asm/uaccess_mm.h:126:12: note: in definition of macro '__get_user_asm'
: "m" (*(ptr)), "i" (err)); \
^~~
>> arch/m68k/include/asm/uaccess_mm.h:180:26: note: in expansion of macro '__get_user'
#define get_user(x, ptr) __get_user(x, ptr)
^~~~~~~~~~
drivers//scsi/sg.c:449:14: note: in expansion of macro 'get_user'
retval = get_user(req_pack_id,
^~~~~~~~
drivers//scsi/sg.c:450:27: error: request for member 'pack_id' in something not a structure or union
&((sg_io_hdr_t *)buf->pack_id));
^
arch/m68k/include/asm/uaccess_mm.h:127:26: note: in definition of macro '__get_user_asm'
(x) = (__force typeof(*(ptr)))(__force unsigned long)__gu_val; \
^~~
>> arch/m68k/include/asm/uaccess_mm.h:180:26: note: in expansion of macro '__get_user'
#define get_user(x, ptr) __get_user(x, ptr)
^~~~~~~~~~
drivers//scsi/sg.c:449:14: note: in expansion of macro 'get_user'
retval = get_user(req_pack_id,
^~~~~~~~
drivers//scsi/sg.c:450:27: error: request for member 'pack_id' in something not a structure or union
&((sg_io_hdr_t *)buf->pack_id));
^
arch/m68k/include/asm/uaccess_mm.h:126:12: note: in definition of macro '__get_user_asm'
: "m" (*(ptr)), "i" (err)); \
^~~
>> arch/m68k/include/asm/uaccess_mm.h:180:26: note: in expansion of macro '__get_user'
#define get_user(x, ptr) __get_user(x, ptr)
^~~~~~~~~~
drivers//scsi/sg.c:449:14: note: in expansion of macro 'get_user'
retval = get_user(req_pack_id,
^~~~~~~~
drivers//scsi/sg.c:450:27: error: request for member 'pack_id' in something not a structure or union
&((sg_io_hdr_t *)buf->pack_id));
^
arch/m68k/include/asm/uaccess_mm.h:127:26: note: in definition of macro '__get_user_asm'
(x) = (__force typeof(*(ptr)))(__force unsigned long)__gu_val; \
^~~
>> arch/m68k/include/asm/uaccess_mm.h:180:26: note: in expansion of macro '__get_user'
#define get_user(x, ptr) __get_user(x, ptr)
^~~~~~~~~~
drivers//scsi/sg.c:449:14: note: in expansion of macro 'get_user'
retval = get_user(req_pack_id,
^~~~~~~~
drivers//scsi/sg.c:450:27: error: request for member 'pack_id' in something not a structure or union
&((sg_io_hdr_t *)buf->pack_id));
^
arch/m68k/include/asm/uaccess_mm.h:145:27: note: in definition of macro '__get_user'
const void *__gu_ptr = (ptr); \
^~~
drivers//scsi/sg.c:449:14: note: in expansion of macro 'get_user'
retval = get_user(req_pack_id,
^~~~~~~~
drivers//scsi/sg.c:450:27: error: request for member 'pack_id' in something not a structure or union
&((sg_io_hdr_t *)buf->pack_id));
^
arch/m68k/include/asm/uaccess_mm.h:148:17: note: in definition of macro '__get_user'
__typeof__(*(ptr)) t; \
^~~
drivers//scsi/sg.c:449:14: note: in expansion of macro 'get_user'
retval = get_user(req_pack_id,
^~~~~~~~

vim +/__get_user +180 arch/m68k/include/asm/uaccess_mm.h

^1da177e4 include/asm-m68k/uaccess.h Linus Torvalds 2005-04-16 107
^1da177e4 include/asm-m68k/uaccess.h Linus Torvalds 2005-04-16 108
d94af931a include/asm-m68k/uaccess.h Roman Zippel 2006-06-23 109 #define __get_user_asm(res, x, ptr, type, bwl, reg, err) ({ \
d94af931a include/asm-m68k/uaccess.h Roman Zippel 2006-06-23 110 type __gu_val; \
d94af931a include/asm-m68k/uaccess.h Roman Zippel 2006-06-23 111 asm volatile ("\n" \
e08d703cc arch/m68k/include/asm/uaccess_mm.h Greg Ungerer 2011-10-14 112 "1: "MOVES"."#bwl" %2,%1\n" \
d94af931a include/asm-m68k/uaccess.h Roman Zippel 2006-06-23 113 "2:\n" \
^1da177e4 include/asm-m68k/uaccess.h Linus Torvalds 2005-04-16 114 " .section .fixup,\"ax\"\n" \
^1da177e4 include/asm-m68k/uaccess.h Linus Torvalds 2005-04-16 115 " .even\n" \
d94af931a include/asm-m68k/uaccess.h Roman Zippel 2006-06-23 116 "10: move.l %3,%0\n" \
e08d703cc arch/m68k/include/asm/uaccess_mm.h Greg Ungerer 2011-10-14 117 " sub.l %1,%1\n" \
d94af931a include/asm-m68k/uaccess.h Roman Zippel 2006-06-23 118 " jra 2b\n" \
^1da177e4 include/asm-m68k/uaccess.h Linus Torvalds 2005-04-16 119 " .previous\n" \
d94af931a include/asm-m68k/uaccess.h Roman Zippel 2006-06-23 120 "\n" \
^1da177e4 include/asm-m68k/uaccess.h Linus Torvalds 2005-04-16 121 " .section __ex_table,\"a\"\n" \
^1da177e4 include/asm-m68k/uaccess.h Linus Torvalds 2005-04-16 122 " .align 4\n" \
d94af931a include/asm-m68k/uaccess.h Roman Zippel 2006-06-23 123 " .long 1b,10b\n" \
^1da177e4 include/asm-m68k/uaccess.h Linus Torvalds 2005-04-16 124 " .previous" \
d94af931a include/asm-m68k/uaccess.h Roman Zippel 2006-06-23 125 : "+d" (res), "=&" #reg (__gu_val) \
d94af931a include/asm-m68k/uaccess.h Roman Zippel 2006-06-23 @126 : "m" (*(ptr)), "i" (err)); \
09a2f7cf6 arch/m68k/include/asm/uaccess_mm.h Michael S. Tsirkin 2014-12-12 127 (x) = (__force typeof(*(ptr)))(__force unsigned long)__gu_val; \
d94af931a include/asm-m68k/uaccess.h Roman Zippel 2006-06-23 128 })
^1da177e4 include/asm-m68k/uaccess.h Linus Torvalds 2005-04-16 129
d94af931a include/asm-m68k/uaccess.h Roman Zippel 2006-06-23 130 #define __get_user(x, ptr) \
^1da177e4 include/asm-m68k/uaccess.h Linus Torvalds 2005-04-16 131 ({ \
d94af931a include/asm-m68k/uaccess.h Roman Zippel 2006-06-23 132 int __gu_err = 0; \
11c40f8a6 include/asm-m68k/uaccess.h Al Viro 2006-01-12 133 __chk_user_ptr(ptr); \
^1da177e4 include/asm-m68k/uaccess.h Linus Torvalds 2005-04-16 134 switch (sizeof(*(ptr))) { \
^1da177e4 include/asm-m68k/uaccess.h Linus Torvalds 2005-04-16 135 case 1: \
d94af931a include/asm-m68k/uaccess.h Roman Zippel 2006-06-23 136 __get_user_asm(__gu_err, x, ptr, u8, b, d, -EFAULT); \
^1da177e4 include/asm-m68k/uaccess.h Linus Torvalds 2005-04-16 137 break; \
^1da177e4 include/asm-m68k/uaccess.h Linus Torvalds 2005-04-16 138 case 2: \
631d8b674 arch/m68k/include/asm/uaccess_mm.h Geert Uytterhoeven 2013-06-09 139 __get_user_asm(__gu_err, x, ptr, u16, w, r, -EFAULT); \
^1da177e4 include/asm-m68k/uaccess.h Linus Torvalds 2005-04-16 140 break; \
^1da177e4 include/asm-m68k/uaccess.h Linus Torvalds 2005-04-16 141 case 4: \
d94af931a include/asm-m68k/uaccess.h Roman Zippel 2006-06-23 142 __get_user_asm(__gu_err, x, ptr, u32, l, r, -EFAULT); \
^1da177e4 include/asm-m68k/uaccess.h Linus Torvalds 2005-04-16 143 break; \
7124330da arch/m68k/include/asm/uaccess_mm.h Geert Uytterhoeven 2018-05-14 144 case 8: { \
d94af931a include/asm-m68k/uaccess.h Roman Zippel 2006-06-23 145 const void *__gu_ptr = (ptr); \
7124330da arch/m68k/include/asm/uaccess_mm.h Geert Uytterhoeven 2018-05-14 146 union { \
7124330da arch/m68k/include/asm/uaccess_mm.h Geert Uytterhoeven 2018-05-14 147 u64 l; \
7124330da arch/m68k/include/asm/uaccess_mm.h Geert Uytterhoeven 2018-05-14 148 __typeof__(*(ptr)) t; \
7124330da arch/m68k/include/asm/uaccess_mm.h Geert Uytterhoeven 2018-05-14 149 } __gu_val; \
d94af931a include/asm-m68k/uaccess.h Roman Zippel 2006-06-23 150 asm volatile ("\n" \
e08d703cc arch/m68k/include/asm/uaccess_mm.h Greg Ungerer 2011-10-14 151 "1: "MOVES".l (%2)+,%1\n" \
e08d703cc arch/m68k/include/asm/uaccess_mm.h Greg Ungerer 2011-10-14 152 "2: "MOVES".l (%2),%R1\n" \
d94af931a include/asm-m68k/uaccess.h Roman Zippel 2006-06-23 153 "3:\n" \
d94af931a include/asm-m68k/uaccess.h Roman Zippel 2006-06-23 154 " .section .fixup,\"ax\"\n" \
d94af931a include/asm-m68k/uaccess.h Roman Zippel 2006-06-23 155 " .even\n" \
d94af931a include/asm-m68k/uaccess.h Roman Zippel 2006-06-23 156 "10: move.l %3,%0\n" \
d94af931a include/asm-m68k/uaccess.h Roman Zippel 2006-06-23 157 " sub.l %1,%1\n" \
d94af931a include/asm-m68k/uaccess.h Roman Zippel 2006-06-23 158 " sub.l %R1,%R1\n" \
d94af931a include/asm-m68k/uaccess.h Roman Zippel 2006-06-23 159 " jra 3b\n" \
d94af931a include/asm-m68k/uaccess.h Roman Zippel 2006-06-23 160 " .previous\n" \
d94af931a include/asm-m68k/uaccess.h Roman Zippel 2006-06-23 161 "\n" \
d94af931a include/asm-m68k/uaccess.h Roman Zippel 2006-06-23 162 " .section __ex_table,\"a\"\n" \
d94af931a include/asm-m68k/uaccess.h Roman Zippel 2006-06-23 163 " .align 4\n" \
d94af931a include/asm-m68k/uaccess.h Roman Zippel 2006-06-23 164 " .long 1b,10b\n" \
d94af931a include/asm-m68k/uaccess.h Roman Zippel 2006-06-23 165 " .long 2b,10b\n" \
d94af931a include/asm-m68k/uaccess.h Roman Zippel 2006-06-23 166 " .previous" \
7124330da arch/m68k/include/asm/uaccess_mm.h Geert Uytterhoeven 2018-05-14 167 : "+d" (__gu_err), "=&r" (__gu_val.l), \
d94af931a include/asm-m68k/uaccess.h Roman Zippel 2006-06-23 168 "+a" (__gu_ptr) \
d94af931a include/asm-m68k/uaccess.h Roman Zippel 2006-06-23 169 : "i" (-EFAULT) \
d94af931a include/asm-m68k/uaccess.h Roman Zippel 2006-06-23 170 : "memory"); \
7124330da arch/m68k/include/asm/uaccess_mm.h Geert Uytterhoeven 2018-05-14 171 (x) = __gu_val.t; \
^1da177e4 include/asm-m68k/uaccess.h Linus Torvalds 2005-04-16 172 break; \
7124330da arch/m68k/include/asm/uaccess_mm.h Geert Uytterhoeven 2018-05-14 173 } \
^1da177e4 include/asm-m68k/uaccess.h Linus Torvalds 2005-04-16 174 default: \
^1da177e4 include/asm-m68k/uaccess.h Linus Torvalds 2005-04-16 175 __gu_err = __get_user_bad(); \
^1da177e4 include/asm-m68k/uaccess.h Linus Torvalds 2005-04-16 176 break; \
^1da177e4 include/asm-m68k/uaccess.h Linus Torvalds 2005-04-16 177 } \
^1da177e4 include/asm-m68k/uaccess.h Linus Torvalds 2005-04-16 178 __gu_err; \
^1da177e4 include/asm-m68k/uaccess.h Linus Torvalds 2005-04-16 179 })
d94af931a include/asm-m68k/uaccess.h Roman Zippel 2006-06-23 @180 #define get_user(x, ptr) __get_user(x, ptr)
^1da177e4 include/asm-m68k/uaccess.h Linus Torvalds 2005-04-16 181

:::::: The code at line 180 was first introduced by commit
:::::: d94af931af42152e34539dd4782b1724084a89fb [PATCH] m68k: clean up uaccess.h

:::::: TO: Roman Zippel <zippel@xxxxxxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxx>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip