From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38484) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZwKeF-0005c0-4Z for qemu-devel@nongnu.org; Tue, 10 Nov 2015 20:56:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZwKeE-0002zd-8m for qemu-devel@nongnu.org; Tue, 10 Nov 2015 20:56:31 -0500 Message-ID: <56429FB7.3090105@huawei.com> Date: Wed, 11 Nov 2015 09:53:59 +0800 From: Gonglei MIME-Version: 1.0 References: <1447059810-11376-1-git-send-email-arei.gonglei@huawei.com> <20151109135722.GB27221@stefanha-x1.localdomain> <56419027.8090509@huawei.com> <20151110095616.GB14128@stefanha-x1.localdomain> In-Reply-To: <20151110095616.GB14128@stefanha-x1.localdomain> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3] virtio-blk: trivial code optimization List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: pbonzini@redhat.com, qemu-devel@nongnu.org, qemu-block@nongnu.org On 2015/11/10 17:56, Stefan Hajnoczi wrote: > The C99 standard says: > > 6.3.1.1 Boolean, characters, and integers > > - The rank of a signed integer type shall be greater than the rank of > any signed integer type with less precision. > > ... > > - The rank of any unsigned integer type shall equal the rank of the > corresponding signed integer type, if any. > > 6.3.1.8 Usual arithmetic conversions > > Otherwise, if the operand that has unsigned integer type has rank > greater or equal to the rank of the type of the other operand, then the > operand with signed integer type is converted to the type of the operand > with unsigned integer type. > > So the max_xfer_len int operand must be converted to the higher ranking > unsigned long long. > Thank you so much, it's clear. I'll add a check before subtraction. Please review v4. Regards, -Gonglei