Possible bugs due to: warning: XXX may be used uninitialized in this function
Tomas Carnecky
tom at dbservice.com
Sun Feb 1 18:00:52 PST 2009
On 02/02/2009 02:35 AM, Tomas Carnecky wrote:
> While trying to fix some of the warnings that gcc generates when
> compiling the xserver, I came across two which appear to be real bugs.
> Since they don't appear to be trivial to fix, I'm posting them here for
> further review:
>
>
> Xi/setbmap.c:110 in ProcXSetDeviceButtonMapping()
> http://cgit.freedesktop.org/xorg/xserver/tree/Xi/setbmap.c#n110
>
> 'DeviceIntPtr dev' seems indeed uninitialized and is passed to
> ApplyPointerMapping().
commit bc909f71367a02297e725bb5769c2bcadab22395
Author: Daniel Stone <daniel at fooishbar.org>
Date: Tue Aug 12 00:35:56 2008 +0300
You removed the code that initialized 'dev':
- ret = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess);
- if (ret != Success)
- return ret;
>
>
> hw/xfree86/common/xf86Bus.c:2171 in x_isSubsetOf()
> http://cgit.freedesktop.org/xorg/xserver/tree/hw/xfree86/common/xf86Bus.c#n2171
This code comes from the initial import (commit 9508a382). Is this code
still relevant now that everybody is moving to libpciaccess?
>
> This one is a bit more complicated due to the use of macros, I'll list
> the relevant ones here:
>
> typedef struct {
> unsigned long type;
> memType a;
> memType b;
> } resRange, *resList;
>
> #define RANGE(r,u,v,t) {\
> (r).a = (u);\
> (r).b = (v);\
> (r).type = (t);\
> }
>
> #define rBase a
> #define rMask b
> #define rBegin a
> #define rEnd b
>
> The function uses 'range1.a' without having touched it anywhere before:
>
> RANGE(range1, ((range.rBase& list->sparse_base)
> | (range.rBase& ~list->sparse_mask)
> | ((~list->sparse_base& list->sparse_mask)
> & ~range.rMask))& range1.rMask,
> ^^^^^^^^^^^^
> ((range.rMask | list->sparse_mask)& ~test)
> | (1<< i), range.type);
>
tom
More information about the xorg
mailing list