[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8f919e212d5149e286422d58a5732356@SHMBX02.spreadtrum.com>
Date: Tue, 27 Jun 2017 02:02:13 +0000
From: Zhongping Tan (谭中平)
<Zhongping.Tan@...eadtrum.com>
To: Arnd Bergmann <arnd@...db.de>
CC: Orson Zhai (翟京)
<Orson.Zhai@...eadtrum.com>,
"Greg Kroah-Hartman" <gregkh@...uxfoundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: RE: 答复: [RFC PATCH] char: misc: Init misc->list in a safe way
Ok, firstly we need to discuss the list usage, for list head we need do initialization, but for list node we don't need initialization at all. And for misc_list head, we use LIST_HEAD to define and initialize it. So I don't know why we put INIT_LIST_HEAD(&misc->list) in function misc_register, any bugs when without it?
-----Original Message-----
From: arndbergmann@...il.com [mailto:arndbergmann@...il.com] On Behalf Of Arnd Bergmann
Sent: Monday, June 26, 2017 10:10 PM
To: Zhongping Tan (谭中平)
Cc: Orson Zhai (翟京); Greg Kroah-Hartman; Linux Kernel Mailing List
Subject: Re: 答复: [RFC PATCH] char: misc: Init misc->list in a safe way
On Mon, Jun 26, 2017 at 4:00 PM, Zhongping Tan (谭中平)
<Zhongping.Tan@...eadtrum.com> wrote:
> hi Arnd:
> Another way to describe this question, misc_register shouldn't modify
> the member of the miscdevice especially when return error. Let the caller to ensure the list have been initialized, or when return error, please don't initialize the list.
Why not? The caller should only initialize a couple of fields in the structure (name, minor, fops, ...) not never even look at the list entry, which is really internal to the misc_register()/misc_unregister().
Arnd
Powered by blists - more mailing lists