i2c-ddc: fix oob read
PATCH 1/1 i2c-ddc: fix oob read
Suggested-by Michael Hanselmann <[email protected]>
Signed-off-by Gerd Hoffmann <[email protected]>
--- hw/i2c/i2c-ddc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/i2c/i2c-ddc.c +1 -1
@@ -56,7 +56,7 @@ static int i2c_ddc_rx(I2CSlave *i2c)I2CDDCState *s =I2CDDC (i2c);int value; - value = s->edid_blob[s->reg]; + value = s->edid_blob[s->reg %sizeof (s->edid_blob)]; s->reg++;return value; }
Signature · 1 line
2.9.3
Quoted 2 lines · Gerd Hoffmann
Suggested-by Michael Hanselmann <[email protected]>Signed-off-by Gerd Hoffmann <[email protected]>
Looks good to me.
Reviewed-by Michael Hanselmann <[email protected]>
Quoted 12 lines · Gerd Hoffmann
Suggested-by Michael Hanselmann <[email protected]>Signed-off-by Gerd Hoffmann <[email protected]>--- hw/i2c/i2c-ddc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/i2c/i2c-ddc.c +0
-0
hw/i2c/i2c-ddc.c static int i2c_ddc_rx(I2CSlave *i2c) · line 62
Quoted 8 lines
hw/i2c/i2c-ddc.c +1
-1@@ -56,7 +56,7 @@ static int i2c_ddc_rx(I2CSlave *i2c)I2CDDCState *s =I2CDDC (i2c);int value; - value = s->edid_blob[s->reg]; + value = s->edid_blob[s->reg %sizeof (s->edid_blob)]; s->reg++;return value; }
Reviewed-by Philippe Mathieu-Daudé <[email protected]>