[PATCH xserver 3/8] dmx: Fix a read-from-uninitialized warning

Emil Velikov emil.l.velikov at gmail.com
Fri Apr 6 10:16:42 UTC 2018


On 5 April 2018 at 18:13, Adam Jackson <ajax at redhat.com> wrote:
> ../hw/dmx/dmxpixmap.c: In function ‘dmxBitmapToRegion’:
> ../include/regionstr.h:174:22: warning: ‘Box.x1’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>      (_pReg)->extents = *(_pBox);
>      ~~~~~~~~~~~~~~~~~^~~~~~~~~~
> ../hw/dmx/dmxpixmap.c:208:12: note: ‘Box.x1’ was declared here
>      BoxRec Box;
>             ^~~
>
> Signed-off-by: Adam Jackson <ajax at redhat.com>
> ---
>  hw/dmx/dmxpixmap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/dmx/dmxpixmap.c b/hw/dmx/dmxpixmap.c
> index 17aca9224b..7b317eaef1 100644
> --- a/hw/dmx/dmxpixmap.c
> +++ b/hw/dmx/dmxpixmap.c
> @@ -205,7 +205,7 @@ dmxBitmapToRegion(PixmapPtr pPixmap)
>      RegionPtr pReg, pTmpReg;
>      int x, y;
>      unsigned long previousPixel, currentPixel;
> -    BoxRec Box;
> +    BoxRec Box = { 0, };
As-is it will warn on some gcc/clang versions.
I'd throw in a few more zeroes - 0, 0, 0, 0.

At a later stage, one might as well fold this and the xnest copy into
a helper somewhere ;-)

-Emil


More information about the xorg-devel mailing list