From: kernel test robot <lkp@intel.com>
To: "Kai Mäkisara" <Kai.Makisara@kolumbus.fi>,
linux-scsi@vger.kernel.org, dgilbert@interlog.com
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
martin.petersen@oracle.com,
James.Bottomley@hansenpartnership.com, jmeneghi@redhat.com,
"Kai Mäkisara" <Kai.Makisara@kolumbus.fi>
Subject: Re: [PATCH v1 2/7] scsi: scsi_debug: Add READ BLOCK LIMITS and modify LOAD for tapes
Date: Tue, 11 Feb 2025 18:41:00 +0800 [thread overview]
Message-ID: <202502111805.dXd61ARr-lkp@intel.com> (raw)
In-Reply-To: <20250210191232.185207-3-Kai.Makisara@kolumbus.fi>
Hi Kai,
kernel test robot noticed the following build warnings:
[auto build test WARNING on jejb-scsi/for-next]
[also build test WARNING on mkp-scsi/for-next linus/master v6.14-rc2 next-20250210]
[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#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Kai-M-kisara/scsi-scsi_debug-First-fixes-for-tapes/20250211-031623
base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
patch link: https://lore.kernel.org/r/20250210191232.185207-3-Kai.Makisara%40kolumbus.fi
patch subject: [PATCH v1 2/7] scsi: scsi_debug: Add READ BLOCK LIMITS and modify LOAD for tapes
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20250211/202502111805.dXd61ARr-lkp@intel.com/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250211/202502111805.dXd61ARr-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202502111805.dXd61ARr-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from drivers/scsi/scsi_debug.c:31:
In file included from include/linux/scatterlist.h:8:
In file included from include/linux/mm.h:2224:
include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
504 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
505 | item];
| ~~~~
include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
511 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
512 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
524 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
525 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
>> drivers/scsi/scsi_debug.c:2926:3: warning: variable 'len' is uninitialized when used here [-Wuninitialized]
2926 | len += resp_partition_m_pg(ap, pcontrol, target);
| ^~~
drivers/scsi/scsi_debug.c:2791:28: note: initialize the variable 'len' to silence this warning
2791 | u32 alloc_len, offset, len;
| ^
| = 0
4 warnings generated.
vim +/len +2926 drivers/scsi/scsi_debug.c
2785
2786 static int resp_mode_sense(struct scsi_cmnd *scp,
2787 struct sdebug_dev_info *devip)
2788 {
2789 int pcontrol, pcode, subpcode, bd_len;
2790 unsigned char dev_spec;
2791 u32 alloc_len, offset, len;
2792 int target_dev_id;
2793 int target = scp->device->id;
2794 unsigned char *ap;
2795 unsigned char *arr __free(kfree);
2796 unsigned char *cmd = scp->cmnd;
2797 bool dbd, llbaa, msense_6, is_disk, is_zbc, is_tape;
2798
2799 arr = kzalloc(SDEBUG_MAX_MSENSE_SZ, GFP_ATOMIC);
2800 if (!arr)
2801 return -ENOMEM;
2802 dbd = !!(cmd[1] & 0x8); /* disable block descriptors */
2803 pcontrol = (cmd[2] & 0xc0) >> 6;
2804 pcode = cmd[2] & 0x3f;
2805 subpcode = cmd[3];
2806 msense_6 = (MODE_SENSE == cmd[0]);
2807 llbaa = msense_6 ? false : !!(cmd[1] & 0x10);
2808 is_disk = (sdebug_ptype == TYPE_DISK);
2809 is_zbc = devip->zoned;
2810 is_tape = (sdebug_ptype == TYPE_TAPE);
2811 if ((is_disk || is_zbc || is_tape) && !dbd)
2812 bd_len = llbaa ? 16 : 8;
2813 else
2814 bd_len = 0;
2815 alloc_len = msense_6 ? cmd[4] : get_unaligned_be16(cmd + 7);
2816 if (0x3 == pcontrol) { /* Saving values not supported */
2817 mk_sense_buffer(scp, ILLEGAL_REQUEST, SAVING_PARAMS_UNSUP, 0);
2818 return check_condition_result;
2819 }
2820 target_dev_id = ((devip->sdbg_host->shost->host_no + 1) * 2000) +
2821 (devip->target * 1000) - 3;
2822 /* for disks+zbc set DPOFUA bit and clear write protect (WP) bit */
2823 if (is_disk || is_zbc) {
2824 dev_spec = 0x10; /* =0x90 if WP=1 implies read-only */
2825 if (sdebug_wp)
2826 dev_spec |= 0x80;
2827 } else
2828 dev_spec = 0x0;
2829 if (msense_6) {
2830 arr[2] = dev_spec;
2831 arr[3] = bd_len;
2832 offset = 4;
2833 } else {
2834 arr[3] = dev_spec;
2835 if (16 == bd_len)
2836 arr[4] = 0x1; /* set LONGLBA bit */
2837 arr[7] = bd_len; /* assume 255 or less */
2838 offset = 8;
2839 }
2840 ap = arr + offset;
2841 if ((bd_len > 0) && (!sdebug_capacity))
2842 sdebug_capacity = get_sdebug_capacity();
2843
2844 if (8 == bd_len) {
2845 if (sdebug_capacity > 0xfffffffe)
2846 put_unaligned_be32(0xffffffff, ap + 0);
2847 else
2848 put_unaligned_be32(sdebug_capacity, ap + 0);
2849 if (is_tape) {
2850 ap[0] = devip->tape_density;
2851 put_unaligned_be16(devip->tape_blksize, ap + 6);
2852 } else
2853 put_unaligned_be16(sdebug_sector_size, ap + 6);
2854 offset += bd_len;
2855 ap = arr + offset;
2856 } else if (16 == bd_len) {
2857 if (is_tape) {
2858 mk_sense_invalid_fld(scp, SDEB_IN_DATA, 1, 4);
2859 return check_condition_result;
2860 }
2861 put_unaligned_be64((u64)sdebug_capacity, ap + 0);
2862 put_unaligned_be32(sdebug_sector_size, ap + 12);
2863 offset += bd_len;
2864 ap = arr + offset;
2865 }
2866 if (cmd[2] == 0)
2867 goto only_bd; /* Only block descriptor requested */
2868
2869 /*
2870 * N.B. If len>0 before resp_*_pg() call, then form of that call should be:
2871 * len += resp_*_pg(ap + len, pcontrol, target);
2872 */
2873 switch (pcode) {
2874 case 0x1: /* Read-Write error recovery page, direct access */
2875 if (subpcode > 0x0 && subpcode < 0xff)
2876 goto bad_subpcode;
2877 len = resp_err_recov_pg(ap, pcontrol, target);
2878 offset += len;
2879 break;
2880 case 0x2: /* Disconnect-Reconnect page, all devices */
2881 if (subpcode > 0x0 && subpcode < 0xff)
2882 goto bad_subpcode;
2883 len = resp_disconnect_pg(ap, pcontrol, target);
2884 offset += len;
2885 break;
2886 case 0x3: /* Format device page, direct access */
2887 if (subpcode > 0x0 && subpcode < 0xff)
2888 goto bad_subpcode;
2889 if (is_disk) {
2890 len = resp_format_pg(ap, pcontrol, target);
2891 offset += len;
2892 } else {
2893 goto bad_pcode;
2894 }
2895 break;
2896 case 0x8: /* Caching page, direct access */
2897 if (subpcode > 0x0 && subpcode < 0xff)
2898 goto bad_subpcode;
2899 if (is_disk || is_zbc) {
2900 len = resp_caching_pg(ap, pcontrol, target);
2901 offset += len;
2902 } else {
2903 goto bad_pcode;
2904 }
2905 break;
2906 case 0xa: /* Control Mode page, all devices */
2907 switch (subpcode) {
2908 case 0:
2909 len = resp_ctrl_m_pg(ap, pcontrol, target);
2910 break;
2911 case 0x05:
2912 len = resp_grouping_m_pg(ap, pcontrol, target);
2913 break;
2914 case 0xff:
2915 len = resp_ctrl_m_pg(ap, pcontrol, target);
2916 len += resp_grouping_m_pg(ap + len, pcontrol, target);
2917 break;
2918 default:
2919 goto bad_subpcode;
2920 }
2921 offset += len;
2922 break;
2923 case 0x11: /* Partition Mode Page (tape) */
2924 if (!is_tape)
2925 goto bad_pcode;
> 2926 len += resp_partition_m_pg(ap, pcontrol, target);
2927 offset += len;
2928 break;
2929 case 0x19: /* if spc==1 then sas phy, control+discover */
2930 if (subpcode > 0x2 && subpcode < 0xff)
2931 goto bad_subpcode;
2932 len = 0;
2933 if ((0x0 == subpcode) || (0xff == subpcode))
2934 len += resp_sas_sf_m_pg(ap + len, pcontrol, target);
2935 if ((0x1 == subpcode) || (0xff == subpcode))
2936 len += resp_sas_pcd_m_spg(ap + len, pcontrol, target,
2937 target_dev_id);
2938 if ((0x2 == subpcode) || (0xff == subpcode))
2939 len += resp_sas_sha_m_spg(ap + len, pcontrol);
2940 offset += len;
2941 break;
2942 case 0x1c: /* Informational Exceptions Mode page, all devices */
2943 if (subpcode > 0x0 && subpcode < 0xff)
2944 goto bad_subpcode;
2945 len = resp_iec_m_pg(ap, pcontrol, target);
2946 offset += len;
2947 break;
2948 case 0x3f: /* Read all Mode pages */
2949 if (subpcode > 0x0 && subpcode < 0xff)
2950 goto bad_subpcode;
2951 len = resp_err_recov_pg(ap, pcontrol, target);
2952 len += resp_disconnect_pg(ap + len, pcontrol, target);
2953 if (is_disk) {
2954 len += resp_format_pg(ap + len, pcontrol, target);
2955 len += resp_caching_pg(ap + len, pcontrol, target);
2956 } else if (is_zbc) {
2957 len += resp_caching_pg(ap + len, pcontrol, target);
2958 }
2959 len += resp_ctrl_m_pg(ap + len, pcontrol, target);
2960 if (0xff == subpcode)
2961 len += resp_grouping_m_pg(ap + len, pcontrol, target);
2962 len += resp_sas_sf_m_pg(ap + len, pcontrol, target);
2963 if (0xff == subpcode) {
2964 len += resp_sas_pcd_m_spg(ap + len, pcontrol, target,
2965 target_dev_id);
2966 len += resp_sas_sha_m_spg(ap + len, pcontrol);
2967 }
2968 len += resp_iec_m_pg(ap + len, pcontrol, target);
2969 offset += len;
2970 break;
2971 default:
2972 goto bad_pcode;
2973 }
2974 only_bd:
2975 if (msense_6)
2976 arr[0] = offset - 1;
2977 else
2978 put_unaligned_be16((offset - 2), arr + 0);
2979 return fill_from_dev_buffer(scp, arr, min_t(u32, alloc_len, offset));
2980
2981 bad_pcode:
2982 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 2, 5);
2983 return check_condition_result;
2984
2985 bad_subpcode:
2986 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 3, -1);
2987 return check_condition_result;
2988 }
2989
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next prev parent reply other threads:[~2025-02-11 10:41 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-10 19:12 [PATCH v1 0/7] scsi: scsi_debug: Add more tape support Kai Mäkisara
2025-02-10 19:12 ` [PATCH v1 1/7] scsi: scsi_debug: First fixes for tapes Kai Mäkisara
2025-02-10 19:12 ` [PATCH v1 2/7] scsi: scsi_debug: Add READ BLOCK LIMITS and modify LOAD " Kai Mäkisara
2025-02-11 10:41 ` kernel test robot [this message]
2025-02-11 14:11 ` [PATCH v1b " Kai Mäkisara
2025-02-13 3:11 ` Martin K. Petersen
2025-02-10 19:12 ` [PATCH v1 3/7] scsi: scsi_debug: Add write support with block lengths and 4 bytes of data Kai Mäkisara
2025-02-11 13:08 ` kernel test robot
2025-02-11 14:11 ` [PATCH v1b " Kai Mäkisara
2025-02-10 19:12 ` [PATCH v1 4/7] scsi: scsi_debug: Add read support and update locate for tapes Kai Mäkisara
2025-02-11 15:50 ` kernel test robot
2025-02-11 21:26 ` [PATCH v1b " Kai Mäkisara
2025-02-10 19:12 ` [PATCH v1 5/7] scsi: scsi_debug: Add compression mode page " Kai Mäkisara
2025-02-10 19:12 ` [PATCH v1 6/7] scsi: scsi_debug: Reset tape setting at device reset Kai Mäkisara
2025-02-10 19:12 ` [PATCH v1 7/7] scsi: scsi_debug: Add support for partitioning the tape Kai Mäkisara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202502111805.dXd61ARr-lkp@intel.com \
--to=lkp@intel.com \
--cc=James.Bottomley@hansenpartnership.com \
--cc=Kai.Makisara@kolumbus.fi \
--cc=dgilbert@interlog.com \
--cc=jmeneghi@redhat.com \
--cc=linux-scsi@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=martin.petersen@oracle.com \
--cc=oe-kbuild-all@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox