Re: [PATCH 01/36] target: Handle MI_REPORT_SUPPORTED_OPERATION_CODES

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Thinh,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on 90557fa89d3e99286506593fd5180f699c41b152]

url:    https://github.com/intel-lab-lkp/linux/commits/Thinh-Nguyen/usb-gadget-f_tcm-Enhance-UASP-driver/20220707-074014
base:   90557fa89d3e99286506593fd5180f699c41b152
config: s390-randconfig-c005-20220710 (https://download.01.org/0day-ci/archive/20220712/202207120920.oEIle78M-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 6ce63e267aab79ca87bf63453d34dd3909ab978d)
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/intel-lab-lkp/linux/commit/9a7c7d74b2c2d3c8524342cb0278ab8b77714bad
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Thinh-Nguyen/usb-gadget-f_tcm-Enhance-UASP-driver/20220707-074014
        git checkout 9a7c7d74b2c2d3c8524342cb0278ab8b77714bad
        # save the config file
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=s390 clang-analyzer

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <yujie.liu@xxxxxxxxx>


clang-analyzer warnings: (new ones prefixed by >>)

>> drivers/target/target_core_alua.c:323:9: warning: Array access (from variable 'buf') results in an undefined pointer dereference [clang-analyzer-core.NullDereference]
           buf[1] = supported;
           ~~~    ^
   drivers/target/target_core_alua.c:271:2: note: 'buf' declared without an initial value
           unsigned char *buf;
           ^~~~~~~~~~~~~~~~~~
   drivers/target/target_core_alua.c:274:6: note: Assuming the condition is true
           if (cdb[2] != 1) {
               ^

vim +/buf +323 drivers/target/target_core_alua.c

c66ac9db8d4ad9 Nicholas Bellinger 2010-12-17  261
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  262  /*
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  263   * REPORT_SUPPORTED_OPERATION_CODES
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  264   *
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  265   * See spc4r17 section 6.27
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  266   */
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  267  sense_reason_t
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  268  target_emulate_report_supported_opcodes(struct se_cmd *cmd)
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  269  {
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  270  	unsigned char *cdb = cmd->t_task_cdb;
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  271  	unsigned char *buf;
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  272  	u8 supported = 0;
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  273
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  274  	if (cdb[2] != 1) {
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  275  		pr_warn("Invalid command format %d\n", cdb[2]);
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  276  		goto out;
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  277  	}
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  278
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  279  	buf = transport_kmap_data_sg(cmd);
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  280  	if (!buf)
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  281  		return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  282
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  283  	switch (cdb[3]) {
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  284  	case INQUIRY:
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  285  	case MODE_SENSE:
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  286  	case MODE_SENSE_10:
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  287  	case READ_CAPACITY:
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  288  	case SERVICE_ACTION_IN_16:
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  289  	case REPORT_LUNS:
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  290  	case REQUEST_SENSE:
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  291  	case SYNCHRONIZE_CACHE:
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  292  	case REZERO_UNIT:
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  293  	case SEEK_6:
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  294  	case SEEK_10:
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  295  	case TEST_UNIT_READY:
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  296  	case SEND_DIAGNOSTIC:
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  297  	case MAINTENANCE_IN:
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  298  	case READ_6:
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  299  	case READ_10:
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  300  	case READ_16:
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  301  	case WRITE_6:
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  302  	case WRITE_10:
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  303  	case WRITE_16:
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  304  	case VERIFY_16:
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  305  	case MODE_SELECT:
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  306  	case MODE_SELECT_10:
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  307  	case START_STOP:
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  308  	case SECURITY_PROTOCOL_IN:
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  309  	case SECURITY_PROTOCOL_OUT:
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  310  		supported = 3;
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  311  		break;
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  312  	case ATA_12:
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  313  	case ATA_16:
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  314  	case VERIFY:
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  315  	case ZBC_IN:
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  316  	case ZBC_OUT:
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  317  	default:
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  318  		break;
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  319  	}
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  320
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  321  	transport_kunmap_data_sg(cmd);
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  322  out:
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06 @323  	buf[1] = supported;
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  324  	target_complete_cmd(cmd, SAM_STAT_GOOD);
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  325  	return 0;
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  326  }
9a7c7d74b2c2d3 Thinh Nguyen       2022-07-06  327

--
0-DAY CI Kernel Test Service
https://01.org/lkp



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux