[PATCH 2/6] usb:gadget:mass-storage: refactoring the SCSI command handling

kernel test robot lkp at intel.com
Sun Jun 27 09:29:29 AEST 2021


Hi Igor,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on scsi/for-next linus/master v5.13-rc7 next-20210625]
[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/Igor-Kononenko/usb-gadget-mass-storage-Improve-the-signature-of-SCSI-handler-function/20210627-061851
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: m68k-allmodconfig (attached as .config)
compiler: m68k-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/92c07dc68c51fab87517c2453d8f249c2565deed
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Igor-Kononenko/usb-gadget-mass-storage-Improve-the-signature-of-SCSI-handler-function/20210627-061851
        git checkout 92c07dc68c51fab87517c2453d8f249c2565deed
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=m68k 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>

All warnings (new ones prefixed by >>):

>> drivers/usb/gadget/function/f_mass_storage.c:310:23: warning: initialized field overwritten [-Woverride-init]
     310 |   .do_check_command = &check_command_size_in_blocks
         |                       ^
   drivers/usb/gadget/function/f_mass_storage.c:1948:4: note: in expansion of macro 'CDB_REG_CHECKER_BLK'
    1948 |  { CDB_REG_CHECKER_BLK(READ_6, 6, CDB_SIZE_FIELD_4, DATA_DIR_TO_HOST,
         |    ^~~~~~~~~~~~~~~~~~~
   drivers/usb/gadget/function/f_mass_storage.c:310:23: note: (near initialization for 'cdb_checker_table[6].do_check_command')
     310 |   .do_check_command = &check_command_size_in_blocks
         |                       ^
   drivers/usb/gadget/function/f_mass_storage.c:1948:4: note: in expansion of macro 'CDB_REG_CHECKER_BLK'
    1948 |  { CDB_REG_CHECKER_BLK(READ_6, 6, CDB_SIZE_FIELD_4, DATA_DIR_TO_HOST,
         |    ^~~~~~~~~~~~~~~~~~~
>> drivers/usb/gadget/function/f_mass_storage.c:310:23: warning: initialized field overwritten [-Woverride-init]
     310 |   .do_check_command = &check_command_size_in_blocks
         |                       ^
   drivers/usb/gadget/function/f_mass_storage.c:1950:4: note: in expansion of macro 'CDB_REG_CHECKER_BLK'
    1950 |  { CDB_REG_CHECKER_BLK(READ_10, 10, CDB_SIZE_FIELD_7, DATA_DIR_TO_HOST,
         |    ^~~~~~~~~~~~~~~~~~~
   drivers/usb/gadget/function/f_mass_storage.c:310:23: note: (near initialization for 'cdb_checker_table[7].do_check_command')
     310 |   .do_check_command = &check_command_size_in_blocks
         |                       ^
   drivers/usb/gadget/function/f_mass_storage.c:1950:4: note: in expansion of macro 'CDB_REG_CHECKER_BLK'
    1950 |  { CDB_REG_CHECKER_BLK(READ_10, 10, CDB_SIZE_FIELD_7, DATA_DIR_TO_HOST,
         |    ^~~~~~~~~~~~~~~~~~~
>> drivers/usb/gadget/function/f_mass_storage.c:310:23: warning: initialized field overwritten [-Woverride-init]
     310 |   .do_check_command = &check_command_size_in_blocks
         |                       ^
   drivers/usb/gadget/function/f_mass_storage.c:1952:4: note: in expansion of macro 'CDB_REG_CHECKER_BLK'
    1952 |  { CDB_REG_CHECKER_BLK(READ_12, 12, CDB_SIZE_FIELD_6, DATA_DIR_TO_HOST,
         |    ^~~~~~~~~~~~~~~~~~~
   drivers/usb/gadget/function/f_mass_storage.c:310:23: note: (near initialization for 'cdb_checker_table[8].do_check_command')
     310 |   .do_check_command = &check_command_size_in_blocks
         |                       ^
   drivers/usb/gadget/function/f_mass_storage.c:1952:4: note: in expansion of macro 'CDB_REG_CHECKER_BLK'
    1952 |  { CDB_REG_CHECKER_BLK(READ_12, 12, CDB_SIZE_FIELD_6, DATA_DIR_TO_HOST,
         |    ^~~~~~~~~~~~~~~~~~~
>> drivers/usb/gadget/function/f_mass_storage.c:310:23: warning: initialized field overwritten [-Woverride-init]
     310 |   .do_check_command = &check_command_size_in_blocks
         |                       ^
   drivers/usb/gadget/function/f_mass_storage.c:1973:4: note: in expansion of macro 'CDB_REG_CHECKER_BLK'
    1973 |  { CDB_REG_CHECKER_BLK(VERIFY, 10, CDB_NO_SIZE_FIELD, DATA_DIR_NONE,
         |    ^~~~~~~~~~~~~~~~~~~
   drivers/usb/gadget/function/f_mass_storage.c:310:23: note: (near initialization for 'cdb_checker_table[17].do_check_command')
     310 |   .do_check_command = &check_command_size_in_blocks
         |                       ^
   drivers/usb/gadget/function/f_mass_storage.c:1973:4: note: in expansion of macro 'CDB_REG_CHECKER_BLK'
    1973 |  { CDB_REG_CHECKER_BLK(VERIFY, 10, CDB_NO_SIZE_FIELD, DATA_DIR_NONE,
         |    ^~~~~~~~~~~~~~~~~~~
>> drivers/usb/gadget/function/f_mass_storage.c:310:23: warning: initialized field overwritten [-Woverride-init]
     310 |   .do_check_command = &check_command_size_in_blocks
         |                       ^
   drivers/usb/gadget/function/f_mass_storage.c:1975:4: note: in expansion of macro 'CDB_REG_CHECKER_BLK'
    1975 |  { CDB_REG_CHECKER_BLK(WRITE_6, 6, CDB_SIZE_FIELD_4, DATA_DIR_FROM_HOST,
         |    ^~~~~~~~~~~~~~~~~~~
   drivers/usb/gadget/function/f_mass_storage.c:310:23: note: (near initialization for 'cdb_checker_table[18].do_check_command')
     310 |   .do_check_command = &check_command_size_in_blocks
         |                       ^
   drivers/usb/gadget/function/f_mass_storage.c:1975:4: note: in expansion of macro 'CDB_REG_CHECKER_BLK'
    1975 |  { CDB_REG_CHECKER_BLK(WRITE_6, 6, CDB_SIZE_FIELD_4, DATA_DIR_FROM_HOST,
         |    ^~~~~~~~~~~~~~~~~~~
>> drivers/usb/gadget/function/f_mass_storage.c:310:23: warning: initialized field overwritten [-Woverride-init]
     310 |   .do_check_command = &check_command_size_in_blocks
         |                       ^
   drivers/usb/gadget/function/f_mass_storage.c:1977:4: note: in expansion of macro 'CDB_REG_CHECKER_BLK'
    1977 |  { CDB_REG_CHECKER_BLK(WRITE_10, 10, CDB_SIZE_FIELD_7,
         |    ^~~~~~~~~~~~~~~~~~~
   drivers/usb/gadget/function/f_mass_storage.c:310:23: note: (near initialization for 'cdb_checker_table[19].do_check_command')
     310 |   .do_check_command = &check_command_size_in_blocks
         |                       ^
   drivers/usb/gadget/function/f_mass_storage.c:1977:4: note: in expansion of macro 'CDB_REG_CHECKER_BLK'
    1977 |  { CDB_REG_CHECKER_BLK(WRITE_10, 10, CDB_SIZE_FIELD_7,
         |    ^~~~~~~~~~~~~~~~~~~
>> drivers/usb/gadget/function/f_mass_storage.c:310:23: warning: initialized field overwritten [-Woverride-init]
     310 |   .do_check_command = &check_command_size_in_blocks
         |                       ^
   drivers/usb/gadget/function/f_mass_storage.c:1979:4: note: in expansion of macro 'CDB_REG_CHECKER_BLK'
    1979 |  { CDB_REG_CHECKER_BLK(WRITE_12, 12, CDB_SIZE_FIELD_6,
         |    ^~~~~~~~~~~~~~~~~~~
   drivers/usb/gadget/function/f_mass_storage.c:310:23: note: (near initialization for 'cdb_checker_table[20].do_check_command')
     310 |   .do_check_command = &check_command_size_in_blocks
         |                       ^
   drivers/usb/gadget/function/f_mass_storage.c:1979:4: note: in expansion of macro 'CDB_REG_CHECKER_BLK'
    1979 |  { CDB_REG_CHECKER_BLK(WRITE_12, 12, CDB_SIZE_FIELD_6,
         |    ^~~~~~~~~~~~~~~~~~~
--
   drivers/usb/gadget/function/f_mass_storage.c: In function 'invalidate_sub':
   drivers/usb/gadget/function/f_mass_storage.c:1084:16: warning: variable 'rc' set but not used [-Wunused-but-set-variable]
    1084 |  unsigned long rc;
         |                ^~
   drivers/usb/gadget/function/f_mass_storage.c: At top level:
>> drivers/usb/gadget/function/f_mass_storage.c:310:23: warning: initialized field overwritten [-Woverride-init]
     310 |   .do_check_command = &check_command_size_in_blocks
         |                       ^
   drivers/usb/gadget/function/f_mass_storage.c:1948:4: note: in expansion of macro 'CDB_REG_CHECKER_BLK'
    1948 |  { CDB_REG_CHECKER_BLK(READ_6, 6, CDB_SIZE_FIELD_4, DATA_DIR_TO_HOST,
         |    ^~~~~~~~~~~~~~~~~~~
   drivers/usb/gadget/function/f_mass_storage.c:310:23: note: (near initialization for 'cdb_checker_table[6].do_check_command')
     310 |   .do_check_command = &check_command_size_in_blocks
         |                       ^
   drivers/usb/gadget/function/f_mass_storage.c:1948:4: note: in expansion of macro 'CDB_REG_CHECKER_BLK'
    1948 |  { CDB_REG_CHECKER_BLK(READ_6, 6, CDB_SIZE_FIELD_4, DATA_DIR_TO_HOST,
         |    ^~~~~~~~~~~~~~~~~~~
>> drivers/usb/gadget/function/f_mass_storage.c:310:23: warning: initialized field overwritten [-Woverride-init]
     310 |   .do_check_command = &check_command_size_in_blocks
         |                       ^
   drivers/usb/gadget/function/f_mass_storage.c:1950:4: note: in expansion of macro 'CDB_REG_CHECKER_BLK'
    1950 |  { CDB_REG_CHECKER_BLK(READ_10, 10, CDB_SIZE_FIELD_7, DATA_DIR_TO_HOST,
         |    ^~~~~~~~~~~~~~~~~~~
   drivers/usb/gadget/function/f_mass_storage.c:310:23: note: (near initialization for 'cdb_checker_table[7].do_check_command')
     310 |   .do_check_command = &check_command_size_in_blocks
         |                       ^
   drivers/usb/gadget/function/f_mass_storage.c:1950:4: note: in expansion of macro 'CDB_REG_CHECKER_BLK'
    1950 |  { CDB_REG_CHECKER_BLK(READ_10, 10, CDB_SIZE_FIELD_7, DATA_DIR_TO_HOST,
         |    ^~~~~~~~~~~~~~~~~~~
>> drivers/usb/gadget/function/f_mass_storage.c:310:23: warning: initialized field overwritten [-Woverride-init]
     310 |   .do_check_command = &check_command_size_in_blocks
         |                       ^
   drivers/usb/gadget/function/f_mass_storage.c:1952:4: note: in expansion of macro 'CDB_REG_CHECKER_BLK'
    1952 |  { CDB_REG_CHECKER_BLK(READ_12, 12, CDB_SIZE_FIELD_6, DATA_DIR_TO_HOST,
         |    ^~~~~~~~~~~~~~~~~~~
   drivers/usb/gadget/function/f_mass_storage.c:310:23: note: (near initialization for 'cdb_checker_table[8].do_check_command')
     310 |   .do_check_command = &check_command_size_in_blocks
         |                       ^
   drivers/usb/gadget/function/f_mass_storage.c:1952:4: note: in expansion of macro 'CDB_REG_CHECKER_BLK'
    1952 |  { CDB_REG_CHECKER_BLK(READ_12, 12, CDB_SIZE_FIELD_6, DATA_DIR_TO_HOST,
         |    ^~~~~~~~~~~~~~~~~~~
>> drivers/usb/gadget/function/f_mass_storage.c:310:23: warning: initialized field overwritten [-Woverride-init]
     310 |   .do_check_command = &check_command_size_in_blocks
         |                       ^
   drivers/usb/gadget/function/f_mass_storage.c:1973:4: note: in expansion of macro 'CDB_REG_CHECKER_BLK'
    1973 |  { CDB_REG_CHECKER_BLK(VERIFY, 10, CDB_NO_SIZE_FIELD, DATA_DIR_NONE,
         |    ^~~~~~~~~~~~~~~~~~~
   drivers/usb/gadget/function/f_mass_storage.c:310:23: note: (near initialization for 'cdb_checker_table[17].do_check_command')
     310 |   .do_check_command = &check_command_size_in_blocks
         |                       ^
   drivers/usb/gadget/function/f_mass_storage.c:1973:4: note: in expansion of macro 'CDB_REG_CHECKER_BLK'
    1973 |  { CDB_REG_CHECKER_BLK(VERIFY, 10, CDB_NO_SIZE_FIELD, DATA_DIR_NONE,
         |    ^~~~~~~~~~~~~~~~~~~
>> drivers/usb/gadget/function/f_mass_storage.c:310:23: warning: initialized field overwritten [-Woverride-init]
     310 |   .do_check_command = &check_command_size_in_blocks
         |                       ^
   drivers/usb/gadget/function/f_mass_storage.c:1975:4: note: in expansion of macro 'CDB_REG_CHECKER_BLK'
    1975 |  { CDB_REG_CHECKER_BLK(WRITE_6, 6, CDB_SIZE_FIELD_4, DATA_DIR_FROM_HOST,
         |    ^~~~~~~~~~~~~~~~~~~
   drivers/usb/gadget/function/f_mass_storage.c:310:23: note: (near initialization for 'cdb_checker_table[18].do_check_command')
     310 |   .do_check_command = &check_command_size_in_blocks
         |                       ^
   drivers/usb/gadget/function/f_mass_storage.c:1975:4: note: in expansion of macro 'CDB_REG_CHECKER_BLK'
    1975 |  { CDB_REG_CHECKER_BLK(WRITE_6, 6, CDB_SIZE_FIELD_4, DATA_DIR_FROM_HOST,
         |    ^~~~~~~~~~~~~~~~~~~
>> drivers/usb/gadget/function/f_mass_storage.c:310:23: warning: initialized field overwritten [-Woverride-init]
     310 |   .do_check_command = &check_command_size_in_blocks
         |                       ^
   drivers/usb/gadget/function/f_mass_storage.c:1977:4: note: in expansion of macro 'CDB_REG_CHECKER_BLK'
    1977 |  { CDB_REG_CHECKER_BLK(WRITE_10, 10, CDB_SIZE_FIELD_7,
         |    ^~~~~~~~~~~~~~~~~~~
   drivers/usb/gadget/function/f_mass_storage.c:310:23: note: (near initialization for 'cdb_checker_table[19].do_check_command')
     310 |   .do_check_command = &check_command_size_in_blocks
         |                       ^
   drivers/usb/gadget/function/f_mass_storage.c:1977:4: note: in expansion of macro 'CDB_REG_CHECKER_BLK'
    1977 |  { CDB_REG_CHECKER_BLK(WRITE_10, 10, CDB_SIZE_FIELD_7,
         |    ^~~~~~~~~~~~~~~~~~~
>> drivers/usb/gadget/function/f_mass_storage.c:310:23: warning: initialized field overwritten [-Woverride-init]
     310 |   .do_check_command = &check_command_size_in_blocks
         |                       ^
   drivers/usb/gadget/function/f_mass_storage.c:1979:4: note: in expansion of macro 'CDB_REG_CHECKER_BLK'
    1979 |  { CDB_REG_CHECKER_BLK(WRITE_12, 12, CDB_SIZE_FIELD_6,
         |    ^~~~~~~~~~~~~~~~~~~
   drivers/usb/gadget/function/f_mass_storage.c:310:23: note: (near initialization for 'cdb_checker_table[20].do_check_command')
     310 |   .do_check_command = &check_command_size_in_blocks
         |                       ^
   drivers/usb/gadget/function/f_mass_storage.c:1979:4: note: in expansion of macro 'CDB_REG_CHECKER_BLK'
    1979 |  { CDB_REG_CHECKER_BLK(WRITE_12, 12, CDB_SIZE_FIELD_6,
         |    ^~~~~~~~~~~~~~~~~~~


vim +310 drivers/usb/gadget/function/f_mass_storage.c

   242	
   243	/**
   244	 * @brief The handler of incoming CDB command
   245	 * @param cmd		- SCSI command number
   246	 * @param callback	- The callback of handle the incoming command
   247	 */
   248	#define CDB_REG_HANDLER(cmd, callback)                                         \
   249		.command = (cmd), .do_command = (callback),                            \
   250		.type = CDB_HANDLER_COMMON, .name = (#cmd)
   251	
   252	/**
   253	 * @brief The handler of incoming CDB command
   254	 * @param cmd		- SCSI command nubmer with fsg buffhd
   255	 * @param callback	- The callback of handle the incoming command
   256	 */
   257	#define CDB_REG_HANDLER_BUFFHD(cmd, callback)                                  \
   258		.command = (cmd), .do_command_with_buffhd = (callback),                \
   259		.type = CDB_HANDLER_FSG_BUFFHD, .name = (#cmd)
   260	
   261	/**
   262	 * @see CDB_REG_CHECKER_DS
   263	 * @details Register CDB command without additional check handler.
   264	 */
   265	#define CDB_REG_NO_CHECKER(cmd, si, dir, req)                                  \
   266		.command = (cmd), .direction = (dir), .size_index = (si),              \
   267		.medium_required = (req), .do_check_command = NULL,
   268	
   269	/**
   270	 * @brief Register the CDB command checker, which checks an incoming command
   271	 * by specified criteria.
   272	 * This validator will take care of the specified data size (DS)
   273	 *
   274	 * @param cmd	- SCSI command nubmer
   275	 * @param s		- CDB command size in bytes
   276	 * @param si	- The CDB command might have the recommended response size.
   277	 * This field indicates the size field index in the input CDB command
   278	 * buffer
   279	 * @param dir	- Direction of data transfer of requested CDB command
   280	 * @param mask  - Mask of relevant bytes in the input command buffer.
   281	 * The ordinal number of a bit in the mask indicates that a byte in the
   282	 * CDB command buffer might be present.
   283	 * If that ordinal number bit equals zero, only a zero value must be
   284	 * present in this original byte.
   285	 * @param req	- Indicates that medium MUST be present or might be optional
   286	 * @param ds	- If @param SI member is equal to @enum CDB_SIZE_MANUAL, than this
   287	 * field indicates the custom response buffer size
   288	 */
   289	#define CDB_REG_CHECKER_DS(cmd, s, si, dir, mask, req, ds)                     \
   290		.command = (cmd), .size = (s), .size_index = (si), .direction = (dir), \
   291		.valid_bytes_bitmask = (mask), .medium_required = (req),               \
   292		.data_size_manual = (ds), .do_check_command = &check_command
   293	
   294	/**
   295	 * @see CDB_REG_CHECKER_DS
   296	 * @details The data size is zero.
   297	 * This macro can't be used with the @enum CDB_SIZE_MANUAL
   298	 */
   299	#define CDB_REG_CHECKER(cmd, s, si, dir, mask, req)                            \
   300		CDB_REG_CHECKER_DS(cmd, s, si, dir, mask, req, 0)
   301	
   302	/**
   303	 * @see CDB_REG_CHECKER_DS
   304	 * @details The checker which registried by this macros will validate the input
   305	 * data size in blocks.
   306	 * Block size specified by MSF interface type, in the curlun->blksize.
   307	 */
   308	#define CDB_REG_CHECKER_BLK(cmd, s, si, dir, mask, req)                        \
   309		CDB_REG_CHECKER_DS(cmd, s, si, dir, mask, req, 0),                     \
 > 310			.do_check_command = &check_command_size_in_blocks
   311	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 60468 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20210627/0a0b71bf/attachment-0001.gz>


More information about the openbmc mailing list