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 balbi-usb/testing/next 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: i386-randconfig-s002-20210627 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 reproduce: # apt-get install sparse # sparse version: v0.6.3-341-g8af24329-dirty # https://github.com/0day-ci/linux/commit/db2ec6f1e52293817f380a4875e01c36a4195c19 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 db2ec6f1e52293817f380a4875e01c36a4195c19 # save the attached .config to linux build tree make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 SHELL=/bin/bash drivers/usb/gadget/function/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@xxxxxxxxx> sparse warnings: (new ones prefixed by >>) >> drivers/usb/gadget/function/f_mass_storage.c:1988:57: sparse: sparse: restricted __be16 degrades to integer >> drivers/usb/gadget/function/f_mass_storage.c:2060:30: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] data_len @@ got restricted __be32 [usertype] @@ drivers/usb/gadget/function/f_mass_storage.c:2060:30: sparse: expected unsigned int [usertype] data_len drivers/usb/gadget/function/f_mass_storage.c:2060:30: sparse: got restricted __be32 [usertype] >> drivers/usb/gadget/function/f_mass_storage.c:2062:17: sparse: sparse: cast from restricted __be16 >> drivers/usb/gadget/function/f_mass_storage.c:2061:34: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [usertype] curr_profile @@ got restricted __be16 [usertype] @@ drivers/usb/gadget/function/f_mass_storage.c:2061:34: sparse: expected unsigned short [usertype] curr_profile drivers/usb/gadget/function/f_mass_storage.c:2061:34: sparse: got restricted __be16 [usertype] drivers/usb/gadget/function/f_mass_storage.c:2231:11: sparse: sparse: Initializer entry defined twice drivers/usb/gadget/function/f_mass_storage.c:2231:11: sparse: also defined here drivers/usb/gadget/function/f_mass_storage.c:2233:11: sparse: sparse: Initializer entry defined twice drivers/usb/gadget/function/f_mass_storage.c:2233:11: sparse: also defined here drivers/usb/gadget/function/f_mass_storage.c:2235:11: sparse: sparse: Initializer entry defined twice drivers/usb/gadget/function/f_mass_storage.c:2235:11: sparse: also defined here drivers/usb/gadget/function/f_mass_storage.c:2259:11: sparse: sparse: Initializer entry defined twice drivers/usb/gadget/function/f_mass_storage.c:2259:11: sparse: also defined here drivers/usb/gadget/function/f_mass_storage.c:2261:11: sparse: sparse: Initializer entry defined twice drivers/usb/gadget/function/f_mass_storage.c:2261:11: sparse: also defined here drivers/usb/gadget/function/f_mass_storage.c:2263:11: sparse: sparse: Initializer entry defined twice drivers/usb/gadget/function/f_mass_storage.c:2263:11: sparse: also defined here drivers/usb/gadget/function/f_mass_storage.c:2265:11: sparse: sparse: Initializer entry defined twice drivers/usb/gadget/function/f_mass_storage.c:2265:11: sparse: also defined here drivers/usb/gadget/function/f_mass_storage.c: note: in included file (through include/linux/rcuwait.h, include/linux/percpu-rwsem.h, include/linux/fs.h, ...): include/linux/sched/signal.h:285:28: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@ include/linux/sched/signal.h:285:28: sparse: expected struct spinlock [usertype] *lock include/linux/sched/signal.h:285:28: sparse: got struct spinlock [noderef] __rcu * include/linux/sched/signal.h:287:30: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@ include/linux/sched/signal.h:287:30: sparse: expected struct spinlock [usertype] *lock include/linux/sched/signal.h:287:30: sparse: got struct spinlock [noderef] __rcu * vim +1988 drivers/usb/gadget/function/f_mass_storage.c 1969 1970 /* Adjust current profile which depended on an inserted medium */ 1971 static inline void cdf_populate_profile_list(struct fsg_common *common, 1972 struct cdr_features **feature) 1973 { 1974 __be16 current_media_type = cdr_guess_medium_type(common); 1975 struct mmc_profile *profiles = 1976 (*feature)->feature.profile_list.profiles; 1977 int i; 1978 1979 /* copy profile list to the response buffer */ 1980 memcpy(profiles, cdf_supported_profiles, 1981 sizeof(cdf_supported_profiles)); 1982 for (i = 0; i < CDF_PROFILES_COUNT; ++i) { 1983 /* 1984 * Reset the current profile bit, 1985 * because it might be set from the previous one 1986 */ 1987 profiles[i].current_p = 0; > 1988 if (be16_to_cpu(profiles[i].profile) == current_media_type) { 1989 DBG(common, "Fill current profile: curr=(%04Xh)\n", 1990 be16_to_cpu(profiles[i].profile)); 1991 profiles[i].current_p = 1; 1992 } 1993 } 1994 } 1995 1996 static int do_get_configuration(struct fsg_common *common, 1997 struct fsg_buffhd *bh) 1998 { 1999 struct fsg_lun *curlun = common->curlun; 2000 int i; 2001 struct cdb_get_configuration *cdb = 2002 (struct cdb_get_configuration *)common->cmnd; 2003 size_t buffer_size = sizeof(struct feature_header); 2004 size_t generic_desc_size = sizeof(struct cdb_ft_generic); 2005 struct feature_header *ret_header = (struct feature_header *)bh->buf; 2006 u8 *ret_data = ((u8 *)ret_header) + buffer_size; 2007 2008 LDBG(curlun, "Requesting features from 0x%04X, with RT flag 0x%02X\n", 2009 be16_to_cpu(cdb->sfn), cdb->rt); 2010 2011 if (!common->curlun || !common->curlun->cdrom) 2012 return -EINVAL; 2013 2014 /* Go over *all* features, and copy them according to RT value */ 2015 for (i = 0; i < ARRAY_SIZE(features_table); ++i) { 2016 struct cdb_ft_generic *generic = 2017 (struct cdb_ft_generic *)&features_table[i]; 2018 struct cdr_features *feature = &features_table[i]; 2019 2020 if (feature->populate != NULL) 2021 feature->populate(common, &feature); 2022 2023 // a) RT is 0x00 and feature's code >= SFN 2024 // b) RT is 0x01, feature's code >= SFN and feature has 'current' bit set 2025 // c) RT is 0x02 and feature's code == SFN 2026 2027 if (be16_to_cpu(generic->code) >= be16_to_cpu(cdb->sfn)) { 2028 if ((cdb->rt == CDR_CFG_RT_FULL) || 2029 (cdb->rt == CDR_CFG_RT_CURRENT && 2030 generic->vpc.cur) || 2031 (cdb->rt == CDR_CFG_RT_SPECIFIED_SFN && 2032 be16_to_cpu(generic->code) == 2033 be16_to_cpu(cdb->sfn))) { 2034 LDBG(curlun, "Copying feature 0x%04X\n", 2035 be16_to_cpu(generic->code)); 2036 2037 memset(ret_data, 0, 2038 (generic->length + generic_desc_size)); 2039 /* Copy feature */ 2040 memcpy(ret_data, feature, 2041 (generic->length + generic_desc_size)); 2042 buffer_size += 2043 (generic->length + generic_desc_size); 2044 ret_data += 2045 (generic->length + generic_desc_size); 2046 2047 /* Break the loop if RT is CDR_CFG_RT_SPECIFIED_SFN */ 2048 if (cdb->rt == CDR_CFG_RT_SPECIFIED_SFN) { 2049 LDBG(curlun, 2050 "Got the feature we wanted (0x%04X), breaking the loop\n", 2051 be16_to_cpu(cdb->sfn)); 2052 break; 2053 } 2054 } 2055 } 2056 } 2057 2058 memset(ret_header, 0, sizeof(struct feature_header)); 2059 /* Header */ > 2060 ret_header->data_len = cpu_to_be32(buffer_size - generic_desc_size); > 2061 ret_header->curr_profile = > 2062 cpu_to_be16(cdr_guess_medium_type(common)); 2063 2064 dump_msg(common, "feature header", (u8 *)ret_header, 2065 sizeof(struct feature_header)); 2066 2067 dump_msg(common, "features table", (u8 *)bh->buf, buffer_size); 2068 2069 common->data_size_to_handle = buffer_size; 2070 return 0; 2071 } 2072 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip