coverity: fix address_space_rw model
PATCH 1/1 coverity: fix address_space_rw model
If the is_write argument is true, address_space_rw writes to memory and thus reads from the buffer. The opposite holds if is_write is false. Fix the model.
Cc Markus Armbruster <[email protected]>
Signed-off-by Paolo Bonzini <[email protected]>
--- scripts/coverity-model.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/coverity-model.c +3 -3
@@ -49,7 +49,7 @@ typedef uint64_t hwaddr;typedef uint32_t MemTxResult ;typedef uint64_t MemTxAttrs ; -static void __write (uint8_t *buf,ssize_t len) +static void __bufwrite (uint8_t *buf,ssize_t len) {int first, last;__coverity_negative_sink__ (len);
@@ -59,7 +59,7 @@ static void __write(uint8_t *buf, ssize_t len)__coverity_writeall__ (buf); } -static void __read (uint8_t *buf,ssize_t len) +static void __bufread (uint8_t *buf,ssize_t len) {__coverity_negative_sink__ (len);if (len ==0 )return ;
@@ -74,7 +74,7 @@ MemTxResult address_space_rw(AddressSpace *as, hwaddr addr, MemTxAttrs attrs,// TODO: investigate impact of treating reads as producing // tainted data, with __coverity_tainted_data_argument__(buf). -if (is_write)__write (buf, len);else __read (buf, len); +if (is_write)__bufread (buf, len);else __bufwrite (buf, len);return result; }
Signature · 1 line
2.3.5
Quoted 33 lines · Paolo Bonzini
If the
is_writeargument is true,address_space_rwwrites to memory and thus reads from the buffer. The opposite holds ifis_writeis false. Fix the model.Cc Markus Armbruster <[email protected]>Signed-off-by Paolo Bonzini <[email protected]>--- scripts/coverity-model.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)scripts/coverity-model.c +2
-2@@ -49,7 +49,7 @@ typedef uint64_t hwaddr;typedef uint32_t MemTxResult ;typedef uint64_t MemTxAttrs ; -static void __write (uint8_t *buf,ssize_t len) +static void __bufwrite (uint8_t *buf,ssize_t len) {int first, last;__coverity_negative_sink__ (len);@@ -59,7 +59,7 @@ static void __write(uint8_t *buf, ssize_t len)__coverity_writeall__ (buf); } -static void __read (uint8_t *buf,ssize_t len) +static void __bufread (uint8_t *buf,ssize_t len) {__coverity_negative_sink__ (len);if (len ==0 )return ;
scripts/coverity-model.c MemTxResult address_space_rw(AddressSpace *as, hwaddr addr, MemTxAttrs attrs, · line 80
Quoted 8 lines
scripts/coverity-model.c +1
-1@@ -74,7 +74,7 @@ MemTxResult address_space_rw(AddressSpace *as, hwaddr addr, MemTxAttrs attrs,// TODO: investigate impact of treating reads as producing // tainted data, with __coverity_tainted_data_argument__(buf). -if (is_write)__write (buf, len);else __read (buf, len); +if (is_write)__bufread (buf, len);else __bufwrite (buf, len);return result; }
Good one :)
I can take this through my tree. Thanks!