[bug report] scsi: mpi3mr: Add support for recovering controller

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

 



Hello Kashyap Desai,

Commit fb9b04574f14 ("scsi: mpi3mr: Add support for recovering
controller") from May 20, 2021 (linux-next), leads to the following
Smatch static checker warning:

drivers/scsi/mpi3mr/mpi3mr_fw.c:4605 mpi3mr_memset_buffers() warn: sizeof(void)
drivers/scsi/mpi3mr/mpi3mr_fw.c:4606 mpi3mr_memset_buffers() warn: sizeof(void)
drivers/scsi/mpi3mr/mpi3mr_fw.c:4608 mpi3mr_memset_buffers() warn: sizeof(void)
drivers/scsi/mpi3mr/mpi3mr_fw.c:4610 mpi3mr_memset_buffers() warn: sizeof(void)
drivers/scsi/mpi3mr/mpi3mr_fw.c:4612 mpi3mr_memset_buffers() warn: sizeof(void)
drivers/scsi/mpi3mr/mpi3mr_fw.c:4614 mpi3mr_memset_buffers() warn: sizeof(void)
drivers/scsi/mpi3mr/mpi3mr_fw.c:4617 mpi3mr_memset_buffers() warn: sizeof(void)
drivers/scsi/mpi3mr/mpi3mr_fw.c:4620 mpi3mr_memset_buffers() warn: sizeof(void)

drivers/scsi/mpi3mr/mpi3mr_fw.c
    4590 void mpi3mr_memset_buffers(struct mpi3mr_ioc *mrioc)
    4591 {
    4592         u16 i;
    4593         struct mpi3mr_throttle_group_info *tg;
    4594 
    4595         mrioc->change_count = 0;
    4596         mrioc->active_poll_qcount = 0;
    4597         mrioc->default_qcount = 0;
    4598         if (mrioc->admin_req_base)
    4599                 memset(mrioc->admin_req_base, 0, mrioc->admin_req_q_sz);
    4600         if (mrioc->admin_reply_base)
    4601                 memset(mrioc->admin_reply_base, 0, mrioc->admin_reply_q_sz);
    4602         atomic_set(&mrioc->admin_reply_q_in_use, 0);
    4603 
    4604         if (mrioc->init_cmds.reply) {
--> 4605                 memset(mrioc->init_cmds.reply, 0, sizeof(*mrioc->init_cmds.reply));

This one should probably be:

	memset(mrioc->init_cmds.reply, 0, mrioc->reply_sz);

sizeof() a void is 1.

    4606                 memset(mrioc->bsg_cmds.reply, 0,
    4607                     sizeof(*mrioc->bsg_cmds.reply));
    4608                 memset(mrioc->host_tm_cmds.reply, 0,
    4609                     sizeof(*mrioc->host_tm_cmds.reply));
    4610                 memset(mrioc->pel_cmds.reply, 0,
    4611                     sizeof(*mrioc->pel_cmds.reply));
    4612                 memset(mrioc->pel_abort_cmd.reply, 0,
    4613                     sizeof(*mrioc->pel_abort_cmd.reply));
    4614                 memset(mrioc->transport_cmds.reply, 0,
    4615                     sizeof(*mrioc->transport_cmds.reply));
    4616                 for (i = 0; i < MPI3MR_NUM_DEVRMCMD; i++)
    4617                         memset(mrioc->dev_rmhs_cmds[i].reply, 0,
    4618                             sizeof(*mrioc->dev_rmhs_cmds[i].reply));
    4619                 for (i = 0; i < MPI3MR_NUM_EVTACKCMD; i++)
    4620                         memset(mrioc->evtack_cmds[i].reply, 0,
    4621                             sizeof(*mrioc->evtack_cmds[i].reply));
    4622                 bitmap_clear(mrioc->removepend_bitmap, 0,
    4623                              mrioc->dev_handle_bitmap_bits);
    4624                 bitmap_clear(mrioc->devrem_bitmap, 0, MPI3MR_NUM_DEVRMCMD);
    4625                 bitmap_clear(mrioc->evtack_cmds_bitmap, 0,
    4626                              MPI3MR_NUM_EVTACKCMD);
    4627         }
    4628 
    4629         for (i = 0; i < mrioc->num_queues; i++) {
    4630                 mrioc->op_reply_qinfo[i].qid = 0;
    4631                 mrioc->op_reply_qinfo[i].ci = 0;
    4632                 mrioc->op_reply_qinfo[i].num_replies = 0;
    4633                 mrioc->op_reply_qinfo[i].ephase = 0;
    4634                 atomic_set(&mrioc->op_reply_qinfo[i].pend_ios, 0);
    4635                 atomic_set(&mrioc->op_reply_qinfo[i].in_use, 0);
    4636                 mpi3mr_memset_op_reply_q_buffers(mrioc, i);
    4637 
    4638                 mrioc->req_qinfo[i].ci = 0;
    4639                 mrioc->req_qinfo[i].pi = 0;
    4640                 mrioc->req_qinfo[i].num_requests = 0;
    4641                 mrioc->req_qinfo[i].qid = 0;
    4642                 mrioc->req_qinfo[i].reply_qid = 0;
    4643                 spin_lock_init(&mrioc->req_qinfo[i].q_lock);
    4644                 mpi3mr_memset_op_req_q_buffers(mrioc, i);
    4645         }
    4646 
    4647         atomic_set(&mrioc->pend_large_data_sz, 0);
    4648         if (mrioc->throttle_groups) {
    4649                 tg = mrioc->throttle_groups;
    4650                 for (i = 0; i < mrioc->num_io_throttle_group; i++, tg++) {
    4651                         tg->id = 0;
    4652                         tg->fw_qd = 0;
    4653                         tg->modified_qd = 0;
    4654                         tg->io_divert = 0;
    4655                         tg->need_qd_reduction = 0;
    4656                         tg->high = 0;
    4657                         tg->low = 0;
    4658                         tg->qd_reduction = 0;
    4659                         atomic_set(&tg->pend_large_data_sz, 0);
    4660                 }
    4661         }
    4662 }

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