qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] i2c-ddc: fix oob read
@ 2019-01-08 10:23 Gerd Hoffmann
  2019-01-08 10:38 ` Michael Hanselmann
  2019-01-08 14:31 ` Philippe Mathieu-Daudé
  0 siblings, 2 replies; 3+ messages in thread
From: Gerd Hoffmann @ 2019-01-08 10:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: public, Gerd Hoffmann

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] i2c-ddc: fix oob read
  2019-01-08 10:23 [Qemu-devel] [PATCH] i2c-ddc: fix oob read Gerd Hoffmann
@ 2019-01-08 10:38 ` Michael Hanselmann
  2019-01-08 14:31 ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Hanselmann @ 2019-01-08 10:38 UTC (permalink / raw)
  To: Gerd Hoffmann, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 225 bytes --]

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>


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] i2c-ddc: fix oob read
  2019-01-08 10:23 [Qemu-devel] [PATCH] i2c-ddc: fix oob read Gerd Hoffmann
  2019-01-08 10:38 ` Michael Hanselmann
@ 2019-01-08 14:31 ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-01-08 14:31 UTC (permalink / raw)
  To: Gerd Hoffmann, qemu-devel; +Cc: public

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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-01-08 14:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-08 10:23 [Qemu-devel] [PATCH] i2c-ddc: fix oob read Gerd Hoffmann
2019-01-08 10:38 ` Michael Hanselmann
2019-01-08 14:31 ` Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).