Re: [git patches 1/2] warnings: attack valid cases spotted by warnings

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

 



Roland Dreier wrote:
In this case the code is basically

	u32 x;

	for (n = 0; cond; ++n) {
		...
		if (!n)
			x = something;
		...
	}

	if (n) {
		...
		use(x);
		...
	}

and gcc still warns...


Interestingly, the above accurately describes a common code pattern matching code which caused gcc to emit the uninit'd-var warnings.

For the record I think initializating 'f0' to zero is safer for the reasons Linus gave, and in addition, f0 is or'd with a value written to a hardware register, which means things should go awry (if they go) in a semi-predictable manner.

According to the assembly language produced, sure it is larger -- by one (per function) MOV that is adjacent to other initializations, making it highly likely the initializations are all streamed together. I doubt one MOV per function will make a huge difference, considering the peace of mind it buys.

	Jeff


-
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux