From: Corey Minyard Date: Mon, 29 Oct 2007 21:37:13 +0000 (-0700) Subject: IPMI: fix comparison in demangle_device_id X-Git-Tag: v2.6.24-rc2~90 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=64e862a579015d229b8e40b6bc4ac3612e9656e1;p=linux-2.6 IPMI: fix comparison in demangle_device_id Coverity spotted some incorrect code in a recent change to the IPMI driver; this patch make sure the data is really long enough to pull the manufacturer id and product id out of a get device id message. Signed-off-by: Corey Minyard Cc: Adrian Bunk Cc: Stian Jordet Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h index 56ae438ae5..6e8cec5033 100644 --- a/include/linux/ipmi_smi.h +++ b/include/linux/ipmi_smi.h @@ -173,7 +173,7 @@ static inline int ipmi_demangle_device_id(const unsigned char *data, id->firmware_revision_2 = data[3]; id->ipmi_version = data[4]; id->additional_device_support = data[5]; - if (data_len >= 6) { + if (data_len >= 11) { id->manufacturer_id = (data[6] | (data[7] << 8) | (data[8] << 16)); id->product_id = data[9] | (data[10] << 8);