Le 09/01/2017 à 19:43, Peter Maydell a écrit : > The dp8393x has several 32-bit values which are formed by concatenating > two 16 bit device register values. Attempting to do these inline > with ((s->reg[HI] << 16) | s->reg[LO]) can result in an unintended > sign extension because "x << 16" is of type 'int' even though s->reg > is unsigned, and so if the expression is used in a context where > it is cast to uint64_t the value is incorrectly sign-extended. > Fix this by using accessor functions with a uint32_t return type; > this also makes the code a bit easier to read. > > This should fix Coverity issues 1307765, 1307766, 1307767, 1307768. > > (To avoid having a ctda read function only used in a DPRINTF, > we move the DPRINTF down slightly so it can use the ttda function.) > > Signed-off-by: Peter Maydell <peter.mayd...@linaro.org>
Reviewed-by: Laurent Vivier <laur...@vivier.eu> FWIW, I've tested a port of this patch with Quadra 800 emulation, and it works: Tested-by: Laurent Vivier <laur...@vivier.eu> Laurent