lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4C85FBE3.4000605@gmail.com>
Date:	Tue, 07 Sep 2010 10:46:27 +0200
From:	Jiri Slaby <jirislaby@...il.com>
To:	Javier Martinez Canillas <martinez.javier@...il.com>
CC:	Greg Kroah-Hartman <gregkh@...e.de>,
	Bill Pemberton <wfp5p@...ginia.edu>,
	Arnaud Patard <apatard@...driva.com>,
	Randy Dunlap <randy.dunlap@...cle.com>,
	devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] staging: xgifb: Initialize uninitialized variables

On 09/07/2010 07:34 AM, Javier Martinez Canillas wrote:
> Current patch solves compilation warnings in staging/xgifb for using possibly uninitialized variables.
> 
> Signed-off-by: Javier Martinez Canillas <martinez.javier@...il.com>
> ---
>  drivers/staging/xgifb/vb_setmode.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
> index c4db2fc..720a592 100644
> --- a/drivers/staging/xgifb/vb_setmode.c
> +++ b/drivers/staging/xgifb/vb_setmode.c
> @@ -376,7 +376,7 @@ void InitTo330Pointer(unsigned char ChipType, struct vb_device_info *pVBInfo)
>  unsigned char XGISetModeNew(struct xgi_hw_device_info *HwDeviceExtension,
>  			unsigned short ModeNo)
>  {
> -	unsigned short ModeIdIndex;
> +	unsigned short ModeIdIndex = 0;
>  	/* unsigned char *pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress; */
>  	struct vb_device_info VBINF;
>  	struct vb_device_info *pVBInfo = &VBINF;

No, please don't. This is a compiler bug.

The first use in that function is:
XGI_SearchModeID( ModeNo , &ModeIdIndex, pVBInfo );

and that function contains:
if (XYZ) {
  for( *ModeIdIndex = 0 ; ; ( *ModeIdIndex )++ )
    ...
} else {
  for( *ModeIdIndex = 0 ; ; ( *ModeIdIndex )++ )
    ...
}

So your compiler is foolish if that emits a warning.

> @@ -3834,7 +3834,7 @@ unsigned char XGI_SetCRT2Group301(unsigned short ModeNo,
>  		struct xgi_hw_device_info *HwDeviceExtension,
>  		struct vb_device_info *pVBInfo)
>  {
> -	unsigned short tempbx, ModeIdIndex, RefreshRateTableIndex;
> +	unsigned short tempbx, ModeIdIndex = 0, RefreshRateTableIndex;
>  
>  	tempbx = pVBInfo->VBInfo;
>  	pVBInfo->SetFlag |= ProgrammingCRT2;

The same here.

regards,
-- 
js
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ