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

[Xen-devel] [PATCH] APEI: pull a signedness check ahead for Coverity's sake


  • To: "xen-devel" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Jan Beulich" <JBeulich@xxxxxxxx>
  • Date: Wed, 08 Jun 2016 05:37:28 -0600
  • Delivery-date: Wed, 08 Jun 2016 11:37:57 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>

On 64-bit architectures (which is all we care about right now in ACPI
code), the value coming from a __u32 field makes "len" positive anyway,
but since from an abstract pov the tool is right, let's just re-order
things.

Coverity ID: 1204965

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/xen/drivers/acpi/apei/erst.c
+++ b/xen/drivers/acpi/apei/erst.c
@@ -672,9 +672,11 @@ static ssize_t __erst_read(u64 record_id
        if (rcd_tmp->record_length > buflen)
                return -ENOBUFS;
        len = rcd_tmp->record_length;
+       if (len < 0)
+               return -ERANGE;
        memcpy(record, rcd_tmp, len);
 
-       return len >= 0 ? len : -ERANGE;
+       return len;
 }
 
 /*



Attachment: CID1204965.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.