Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 May 2019 15:21:24 +0000
From:      Alexey Dokuchaev <danfe@freebsd.org>
To:        Alexander Motin <mav@freebsd.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r310524 - in head/sys/cam: ctl scsi
Message-ID:  <20190522152124.GA36423@FreeBSD.org>
In-Reply-To: <201612241742.uBOHgYQp045291@repo.freebsd.org>
References:  <201612241742.uBOHgYQp045291@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Dec 24, 2016 at 05:42:34PM +0000, Alexander Motin wrote:
> New Revision: 310524
> URL: https://svnweb.freebsd.org/changeset/base/310524
> 
> Log:
>   Improve length handling when writing sense data.
>   
>    - Allow maximal sense size limitation via Control Extension mode page.
>    - When sense size limited, include descriptors atomically: whole or none.
>    - Set new SDAT_OVFL bit if some descriptors don't fit the limit.
>    - Report real written sense length instead of static maximal 252 bytes.
>   
> Modified: head/sys/cam/scsi/scsi_all.c
> ...
>  				break;
> -			case SSD_ELEM_DESC:
> -			default:
> -
> -				/*
> -				 * If the user passes in descriptor sense,
> -				 * we can't handle that in fixed format.
> -				 * So just skip it, and any unknown argument
> -				 * types.
> -				 */
> +			}
> +			if (len > sizeof(sense->cmd_spec_info)) {
> +				data += len - sizeof(sense->cmd_spec_info);
> +				len -= len - sizeof(sense->cmd_spec_info);

PVS Studio complains here: error: V765 A compound assignment expression 'x
-= x - ...' is suspicious. Consider inspecting it for a possible error.

This "len -= len - sizeof(...)" indeed looks weird, can you take a look?

./danfe



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190522152124.GA36423>