re: target: Split transport_send_check_condition_and_sense()

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

 



Hello Bart Van Assche,

The patch ab78fef4d5f7: "target: Split
transport_send_check_condition_and_sense()" from Jul 8, 2015, leads
to the following static checker warning:

	drivers/target/target_core_transport.c:2909 translate_sense_reason()
	error: XXX potentially using uninitialized 'asc'.

drivers/target/target_core_transport.c
  2893  static int translate_sense_reason(struct se_cmd *cmd, sense_reason_t reason)
  2894  {
  2895          const struct sense_info *si;
  2896          u8 *buffer = cmd->sense_buffer;
  2897          int r = (__force int)reason;
  2898          u8 asc, ascq;
                   ^^^
  2899          bool desc_format = target_sense_desc_format(cmd->se_dev);
  2900  
  2901          if (r < ARRAY_SIZE(sense_info_table) && sense_info_table[r].key)
  2902                  si = &sense_info_table[r];
  2903          else
  2904                  si = &sense_info_table[(__force int)
  2905                                         TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE];
  2906  
  2907          if (reason == TCM_CHECK_CONDITION_UNIT_ATTENTION) {
  2908                  core_scsi3_ua_for_check_condition(cmd, &asc, &ascq);
                                                               ^^^^
No checking for negative returns.

  2909                  WARN_ON_ONCE(asc == 0);
                                     ^^^^^^^^
  2910          } else if (si->asc == 0) {
  2911                  WARN_ON_ONCE(cmd->scsi_asc == 0);
  2912                  asc = cmd->scsi_asc;
  2913                  ascq = cmd->scsi_ascq;
  2914          } else {


regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux