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

[Xen-changelog] [xen master] APEI: pull a signedness check ahead for Coverity's sake



commit 0961444c07f57a43fed6788e2df90e43b51cdb06
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Fri Jun 17 10:22:22 2016 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri Jun 17 10:22:22 2016 +0200

    APEI: pull a signedness check ahead for Coverity's sake
    
    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>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/drivers/acpi/apei/erst.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/acpi/apei/erst.c b/xen/drivers/acpi/apei/erst.c
index 8d721d0..14acf5d 100644
--- 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, struct 
cper_record_header *record,
        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;
 }
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

 


Rackspace

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