lkml.org 
[lkml]   [2017]   [Oct]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH v10 13/15] platform/x86: wmi: create userspace interface for drivers
Date
> -----Original Message-----
> From: Greg KH [mailto:greg@kroah.com]
> Sent: Friday, October 20, 2017 8:22 AM
> To: Limonciello, Mario <Mario_Limonciello@Dell.com>
> Cc: dvhart@infradead.org; Andy Shevchenko <andy.shevchenko@gmail.com>;
> LKML <linux-kernel@vger.kernel.org>; platform-driver-x86@vger.kernel.org; Andy
> Lutomirski <luto@kernel.org>; quasisec@google.com; pali.rohar@gmail.com;
> rjw@rjwysocki.net; mjg59@google.com; hch@lst.de; Alan Cox
> <gnomes@lxorguk.ukuu.org.uk>
> Subject: Re: [PATCH v10 13/15] platform/x86: wmi: create userspace interface for
> drivers
>
> On Thu, Oct 19, 2017 at 12:50:16PM -0500, Mario Limonciello wrote:
> > + wblock = container_of(wdev, struct wmi_block, dev);
> > + if (!wblock)
> > + return -ENODEV;
>
> How can container_of() ever return NULL? If so, you have a very odd
> memory layout...
>

I'm assuming this is from set_required_buffer_size right?

The symbol is exported out for other drivers to use. It's possible for another
driver to allocate a wmi_device structure that's not part of a wblock.

> > + list_for_each_entry_safe(wblock, next, &wmi_block_list, list) {
> > + wdriver = container_of(wblock->dev.dev.driver,
> > + struct wmi_driver, driver);
> > + if (!wdriver)
> > + continue;
>
> Same here. And other places in this file.
>

This one it's possible that a driver isn't bound to a device, and when
that happens wdriver is NULL.

\
 
 \ /
  Last update: 2017-10-22 17:41    [W:0.104 / U:0.216 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site