[bug report] scsi: qla2xxx: Add support for mailbox passthru

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

 



Hello Bikash Hazarika,

Commit 9e1c3206960f ("scsi: qla2xxx: Add support for mailbox
passthru") from Sep 8, 2021 (linux-next), leads to the following
Smatch static checker warning:

	drivers/scsi/qla2xxx/qla_bsg.c:3241 qla2x00_mailbox_passthru()
	warn: sizeof(void)

drivers/scsi/qla2xxx/qla_bsg.c
    3205 int qla2x00_mailbox_passthru(struct bsg_job *bsg_job)
    3206 {
    3207         struct fc_bsg_reply *bsg_reply = bsg_job->reply;
    3208         scsi_qla_host_t *vha = shost_priv(fc_bsg_to_shost(bsg_job));
    3209         int ret = -EINVAL;
    3210         int ptsize = sizeof(struct qla_mbx_passthru);
    3211         struct qla_mbx_passthru *req_data = NULL;
    3212         uint32_t req_data_len;
    3213 
    3214         req_data_len = bsg_job->request_payload.payload_len;
    3215         if (req_data_len != ptsize) {
    3216                 ql_log(ql_log_warn, vha, 0xf0a3, "req_data_len invalid.\n");
    3217                 return -EIO;
    3218         }
    3219         req_data = kzalloc(ptsize, GFP_KERNEL);
    3220         if (!req_data) {
    3221                 ql_log(ql_log_warn, vha, 0xf0a4,
    3222                        "req_data memory allocation failure.\n");
    3223                 return -ENOMEM;
    3224         }
    3225 
    3226         /* Copy the request buffer in req_data */
    3227         sg_copy_to_buffer(bsg_job->request_payload.sg_list,
    3228                           bsg_job->request_payload.sg_cnt, req_data, ptsize);
    3229         ret = qla_mailbox_passthru(vha, req_data->mbx_in, req_data->mbx_out);
    3230 
    3231         /* Copy the req_data in  request buffer */
    3232         sg_copy_from_buffer(bsg_job->reply_payload.sg_list,
    3233                             bsg_job->reply_payload.sg_cnt, req_data, ptsize);
    3234 
    3235         bsg_reply->reply_payload_rcv_len = ptsize;
    3236         if (ret == QLA_SUCCESS)
    3237                 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = EXT_STATUS_OK;
    3238         else
    3239                 bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = EXT_STATUS_ERR;
    3240 
--> 3241         bsg_job->reply_len = sizeof(*bsg_job->reply);

bsg_job->reply is a void pointer so the sizeof() is 1.  Even if this is
correct, it would be more clear to say size(u8) or something.

    3242         bsg_reply->result = DID_OK << 16;
    3243         bsg_job_done(bsg_job, bsg_reply->result, bsg_reply->reply_payload_rcv_len);
    3244 
    3245         kfree(req_data);
    3246 
    3247         return ret;
    3248 }

regards,
dan carpenter




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux