Re: [PATCH] scsi: mpi3mr: clean up mpi3mr_print_ioc_info()

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

 



On Thu, Sep 16, 2021 at 04:26:05PM +0300, Dan Carpenter wrote:
> @@ -3046,34 +3045,21 @@ mpi3mr_print_ioc_info(struct mpi3mr_ioc *mrioc)
>  	for (i = 0; i < ARRAY_SIZE(mpi3mr_protocols); i++) {
>  		if (mrioc->facts.protocol_flags &
>  		    mpi3mr_protocols[i].protocol) {
> -			if (is_string_nonempty &&
> -			    (bytes_wrote < sizeof(protocol)))
> -				bytes_wrote += snprintf(protocol + bytes_wrote,
> -				    (sizeof(protocol) - bytes_wrote), ",");
> -
> -			if (bytes_wrote < sizeof(protocol))
> -				bytes_wrote += snprintf(protocol + bytes_wrote,
> -				    (sizeof(protocol) - bytes_wrote), "%s",

Part of the reason I sent this patch is because the
"bytes_wrote < sizeof(protocol)" comparison is off by one.  It should
have been "bytes_wrote <= sizeof(protocol)".  Being off by one is
harmless here.

I should have written about this in the commit message.  I really messed
this one up all sorts of different ways.  :/  I'll try do better in the
future.

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