[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAErSpo7c+ttzzLJYqA=MNkMnoTu2V29BXc=ohD4uVSMQeCShkQ@mail.gmail.com>
Date: Mon, 10 Sep 2012 18:02:45 -0600
From: Bjorn Helgaas <bhelgaas@...gle.com>
To: Fengguang Wu <fengguang.wu@...el.com>
Cc: Jiri Slaby <jslaby@...e.cz>, linux-pci@...r.kernel.org,
linux-kernel@...r.kernel.org, jirislaby@...il.com,
Feng Tang <feng.tang@...el.com>
Subject: Re: [PATCH 1/1] PCI: fix on-stack pci_device_id's
On Mon, Sep 10, 2012 at 4:55 PM, Fengguang Wu <fengguang.wu@...el.com> wrote:
> On Mon, Sep 10, 2012 at 02:44:32PM -0600, Bjorn Helgaas wrote:
>> On Mon, Sep 10, 2012 at 1:36 PM, Jiri Slaby <jslaby@...e.cz> wrote:
>> > Commit "PCI: Use pci_device_id on stack for pci_get_subsys/class() to
>> > avoid kmalloc" changed heap allocations to on-stack variables, but it
>> > did not add initialization of other than set members. This causes
>> > random failures during bootup wherever pci device is needed to be
>> > found. Hence the boot just hangs or panics.
>> >
>> > This patches fixes it by setting the content of pci_device_id directly
>> > in the initializer.
>>
>> Nice! I fixed this already by adding a memset(), but I like your way
>> better. I knew we could initialize members of a structure on the
>> stack, but I didn't know C guaranteed that uninitialized members would
>> be implicitly initialized also. But apparently it does:
>>
>> http://stackoverflow.com/questions/10828294/c-and-c-partial-initialization-of-automatic-structure
>
> Signed-off-by: Fengguang Wu <fengguang.wu@...el.com>
>
> For the record, I proposed the same initializer-style fix in the very
> beginning that you didn't realize its beauty until now ;-)
Yep, I credited you :) Sorry I didn't look closely enough to begin with.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists