qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] scsi: Don't deference in_buf if NULL


From: Anthoine Bourgeois
Subject: Re: [Qemu-devel] [PATCH] scsi: Don't deference in_buf if NULL
Date: Fri, 5 Jan 2018 17:45:47 +0100
User-agent: NeoMutt/20170609 (1.8.3)

On Thu, Jan 04, 2018 at 11:02:25AM -0600, Eric Blake wrote:
On 01/03/2018 08:42 PM, Fam Zheng wrote:
scsi_disk_emulate_command passes in_buf=NULL and in_len=0 in the
REQUEST_SENSE branch. Inline the fixed_in evaluation and put it after
the in_len test.

Signed-off-by: Fam Zheng <address@hidden>
---
 scsi/utils.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Huh?  'fixed' is already a bool, so '!!fixed' is just extra typing that
makes things harder to read.  Did you mean:

if (in_len && fixed == !(in_buf[0] & 2))

as something that is slightly more legible (the LHS is already bool, the
RHS uses a single ! to convert a bitwise test into a bool with the
correct sense)?

It seems correct and clearer.

With Eric's modification:
Tested-by: Anthoine Bourgeois <address@hidden>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]