Re: kobject_init and the zeroed-out-memory requirement

2014-10-05 Thread Guenter Roeck
On 10/05/2014 08:25 PM, Greg KH wrote: On Sun, Oct 05, 2014 at 07:09:50PM -0700, Guenter Roeck wrote: On Sun, Oct 05, 2014 at 04:24:57PM -0700, Greg KH wrote: On Sun, Oct 05, 2014 at 06:13:05PM -0400, Jason Noakes wrote: No driver should be working with "raw" kobjects. I don't agree, but it'

Re: kobject_init and the zeroed-out-memory requirement

2014-10-05 Thread Greg KH
On Sun, Oct 05, 2014 at 07:09:50PM -0700, Guenter Roeck wrote: > On Sun, Oct 05, 2014 at 04:24:57PM -0700, Greg KH wrote: > > On Sun, Oct 05, 2014 at 06:13:05PM -0400, Jason Noakes wrote: > > > > No driver should be working with "raw" kobjects. > > > > > > I don't agree, but it's irrelevant. > >

Re: kobject_init and the zeroed-out-memory requirement

2014-10-05 Thread Guenter Roeck
On Sun, Oct 05, 2014 at 04:24:57PM -0700, Greg KH wrote: > On Sun, Oct 05, 2014 at 06:13:05PM -0400, Jason Noakes wrote: > > > No driver should be working with "raw" kobjects. > > > > I don't agree, but it's irrelevant. > > Not at all. I'd wager that if a driver is messing around with a "raw" >

Re: kobject_init and the zeroed-out-memory requirement

2014-10-05 Thread Greg KH
On Sun, Oct 05, 2014 at 06:13:05PM -0400, Jason Noakes wrote: > > No driver should be working with "raw" kobjects. > > I don't agree, but it's irrelevant. Not at all. I'd wager that if a driver is messing around with a "raw" kobject, it is doing something seriously wrong. Of course there are ex

Re: kobject_init and the zeroed-out-memory requirement

2014-10-05 Thread Jason Noakes
> No driver should be working with "raw" kobjects. I don't agree, but it's irrelevant. If the functions are exported and documented, the documentation should be complete. > kobject_init() has been there for a very long time, and yes, we don't > always have the best naming scheme in the kernel, th

Re: kobject_init and the zeroed-out-memory requirement

2014-10-05 Thread Greg KH
On Sun, Oct 05, 2014 at 04:47:42PM -0400, Jason Noakes wrote: > > Is there any in-kernel code that does not properly zero out the memory > > before calling kobject_init()? > > I'm not sure. I didn't find any, but I've seen it bite people writing > drivers more than once where I work, and the lates

Re: kobject_init and the zeroed-out-memory requirement

2014-10-05 Thread Jason Noakes
> Is there any in-kernel code that does not properly zero out the memory > before calling kobject_init()? I'm not sure. I didn't find any, but I've seen it bite people writing drivers more than once where I work, and the latest oops I just debugged a few days ago prompted me to address the issue a

Re: kobject_init and the zeroed-out-memory requirement

2014-10-05 Thread Greg KH
On Sun, Oct 05, 2014 at 04:02:14PM -0400, Jason Noakes wrote: > I noticed that kobject_init() requres the kobject passed in to be zeroed out > fully first. That is because people were trying to reuse objects without destroying them first. So try to detect this and prevent the developer from doing

Fwd: kobject_init and the zeroed-out-memory requirement

2014-10-05 Thread Jason Noakes
I noticed that kobject_init() requres the kobject passed in to be zeroed out fully first. Many other *_init kernel routines (cdev_init, kref_init, mutex_init, spin_lock_init, etc) do not have the same requirement - they work on fully uninitialized memory. Documentation/kobject.txt does not mentio