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-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux