From owner-svn-src-all@freebsd.org Wed May 22 15:21:24 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2BDD15AE5C5; Wed, 22 May 2019 15:21:24 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5173C8A727; Wed, 22 May 2019 15:21:24 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 2694616663; Wed, 22 May 2019 15:21:24 +0000 (UTC) Date: Wed, 22 May 2019 15:21:24 +0000 From: Alexey Dokuchaev To: Alexander Motin 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> References: <201612241742.uBOHgYQp045291@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201612241742.uBOHgYQp045291@repo.freebsd.org> User-Agent: Mutt/1.11.4 (2019-03-13) X-Rspamd-Queue-Id: 5173C8A727 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.82 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.82)[-0.825,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 May 2019 15:21:24 -0000 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