Re: [PATCH] drm/radeon: Fix stack data leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Aug 15, 2010 at 8:11 AM, Jean Delvare <khali@xxxxxxxxxxxx> wrote:
> Always zero-init a structure on the stack which is returned by a
> function. Otherwise you may leak random stack data from previous
> function calls.
>
> This fixes the following warning I was seeing:
>  CC [M]  drivers/gpu/drm/radeon/radeon_atombios.o
> drivers/gpu/drm/radeon/radeon_atombios.c: In function "radeon_atom_get_hpd_info_from_gpio":
> drivers/gpu/drm/radeon/radeon_atombios.c:261: warning: "hpd.plugged_state" is used uninitialized in this function
>
> Signed-off-by: Jean Delvare <khali@xxxxxxxxxxxx>
> Cc: David Airlie <airlied@xxxxxxxx>
> Cc: Alex Deucher <alexdeucher@xxxxxxxxx>
> ---
> As a side, note, passing whole structures on the stack this way seems
> suboptimal. Passing structures by address would be faster (and safer,
> as it stands.)

There are a few places in the connector/encoder init code where this
needs to be cleaned up, just haven't gotten to it yet.  Patch looks
good.  Thanks!

Reviewed-By: Alex Deucher <alexdeucher@xxxxxxxxx>

>
>  drivers/gpu/drm/radeon/radeon_atombios.c |    2 ++
>  1 file changed, 2 insertions(+)
>
> --- linux-2.6.36-rc0.orig/drivers/gpu/drm/radeon/radeon_atombios.c      2010-08-15 10:24:49.000000000 +0200
> +++ linux-2.6.36-rc0/drivers/gpu/drm/radeon/radeon_atombios.c   2010-08-15 13:52:31.000000000 +0200
> @@ -226,6 +226,8 @@ static struct radeon_hpd radeon_atom_get
>        struct radeon_hpd hpd;
>        u32 reg;
>
> +       memset(&hpd, 0, sizeof(struct radeon_hpd));
> +
>        if (ASIC_IS_DCE4(rdev))
>                reg = EVERGREEN_DC_GPIO_HPD_A;
>        else
>
>
> --
> Jean Delvare
>
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux