[Qemu-devel] [PATCH] i2c-ddc: fix oob read

Gerd Hoffmann posted 1 patch 6 years, 10 months ago
Test asan passed
Test checkpatch passed
Test docker-mingw@fedora passed
Test docker-quick@centos7 passed
Test docker-clang@ubuntu passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20190108102301.1957-1-kraxel@redhat.com
hw/i2c/i2c-ddc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[Qemu-devel] [PATCH] i2c-ddc: fix oob read
Posted by Gerd Hoffmann 6 years, 10 months ago
Suggested-by: Michael Hanselmann <public@hansmi.ch>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/i2c/i2c-ddc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/i2c/i2c-ddc.c b/hw/i2c/i2c-ddc.c
index be34fe072c..0a0367ff38 100644
--- a/hw/i2c/i2c-ddc.c
+++ b/hw/i2c/i2c-ddc.c
@@ -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;
 }
-- 
2.9.3


Re: [Qemu-devel] [PATCH] i2c-ddc: fix oob read
Posted by Michael Hanselmann 6 years, 10 months ago
On 08.01.19 11:23, Gerd Hoffmann wrote:
> Suggested-by: Michael Hanselmann <public@hansmi.ch>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

Looks good to me.

Reviewed-by: Michael Hanselmann <public@hansmi.ch>

Re: [Qemu-devel] [PATCH] i2c-ddc: fix oob read
Posted by Philippe Mathieu-Daudé 6 years, 10 months ago
On 1/8/19 11:23 AM, Gerd Hoffmann wrote:
> Suggested-by: Michael Hanselmann <public@hansmi.ch>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  hw/i2c/i2c-ddc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/i2c/i2c-ddc.c b/hw/i2c/i2c-ddc.c
> index be34fe072c..0a0367ff38 100644
> --- a/hw/i2c/i2c-ddc.c
> +++ b/hw/i2c/i2c-ddc.c
> @@ -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é <philmd@redhat.com>