public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Jason Noakes <jjnoakes@gmail.com>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: kobject_init and the zeroed-out-memory requirement
Date: Sun, 5 Oct 2014 20:25:05 -0700	[thread overview]
Message-ID: <20141006032505.GD2722@kroah.com> (raw)
In-Reply-To: <20141006020950.GA29722@roeck-us.net>

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.
> > 
> > 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
> > exceptions, but those are very rare, and exceptions.  A driver should be
> > using the driver core, and the functions and objects provided there, and
> > provided by the bus it lives on.
> > 
> > So, have a pointer to some driver code that is calling
> > kobject_initialize()?  I'd love to see it.
> > 
> 
> Lots to choose from. In drivers/:
> 
> $ git grep kobject_init | wc
>      65     289    4880
> $ git grep kobject_init | grep -v base | wc
>      62     277    4694
> $ git grep kobject_init_and_add | grep -v base | wc
>      47     232    3698
> $ git grep kobject_add | grep -v base | wc
>      20     111    1486

Well, you hit firmware layer, and block devices, which have to deal with
kobjects directly at times.  But these files look "suspicious":
	edac/edac_device_sysfs.c
	edac/edac_pci_sysfs.c
	gpu/drm/ttm/ttm_bo.c
	gpu/drm/ttm/ttm_memory.c
	gpu/drm/ttm/ttm_page_alloc.c
	gpu/drm/ttm/ttm_page_alloc_dma.c
	infiniband/core/cm.c
	infiniband/core/sysfs.c
	infiniband/core/user_mad.c
	infiniband/hw/mlx4/sysfs.c
	infiniband/hw/qib/qib_sysfs.c
	infiniband/hw/usnic/usnic_ib_sysfs.c
	iommu/iommu.c
	parisc/pdc_stable.c
	pci/slot.c
	power/ab8500_fg.c
	power/abx500_chargalg.c
	scsi/iscsi_boot_sysfs.c
	uio/uio.c
	video/fbdev/omap2/dss/manager-sysfs.c
	video/fbdev/omap2/dss/overlay-sysfs.c

I'll look into them tomorrow...

But that's still a very small minority compared to the tens of thousands
of drivers we have, so I still say it's wrong to have a driver deal with
raw kobjects.

thanks,

greg k-h

  reply	other threads:[~2014-10-06  3:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAN2+FEJY29jDF2PkGAYcG_0z=VQ4T+y7Ro56aeqrhSPYQ6ZEdw@mail.gmail.com>
2014-10-05 20:05 ` Fwd: kobject_init and the zeroed-out-memory requirement Jason Noakes
2014-10-05 20:28 ` Greg KH
2014-10-05 20:47   ` Jason Noakes
2014-10-05 21:51     ` Greg KH
2014-10-05 22:13       ` Jason Noakes
2014-10-05 23:24         ` Greg KH
2014-10-06  2:09           ` Guenter Roeck
2014-10-06  3:25             ` Greg KH [this message]
2014-10-06  5:18               ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141006032505.GD2722@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=jjnoakes@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox