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




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux