lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Tue, 24 Mar 2015 11:14:22 +0300
From:	Dan Carpenter <dan.carpenter@...cle.com>
To:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	devel@...verdev.osuosl.org,
	Benjamin Romer <benjamin.romer@...sys.com>,
	David Kershner <david.kershner@...sys.com>,
	linux-kernel@...r.kernel.org, sparmaintainer@...sys.com
Subject: Re: [PATCH v2 2/4] staging: unisys: dev_t initialization

On Mon, Mar 16, 2015 at 04:36:13PM +0100, Greg Kroah-Hartman wrote:
> On Thu, Mar 12, 2015 at 11:00:10PM +0530, Sudip Mukherjee wrote:
> > dev_t is defined to be of unsigned int type, no use initializing
> > it to -1.
> > 
> > Signed-off-by: Sudip Mukherjee <sudip@...torindia.org>
> > ---
> > v2: it was not in v1
> > 
> >  drivers/staging/unisys/visorchipset/file.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/staging/unisys/visorchipset/file.c b/drivers/staging/unisys/visorchipset/file.c
> > index 9ca7f1e..e9459af 100644
> > --- a/drivers/staging/unisys/visorchipset/file.c
> > +++ b/drivers/staging/unisys/visorchipset/file.c
> > @@ -30,7 +30,7 @@
> >  
> >  static struct cdev file_cdev;
> >  static struct visorchannel **file_controlvm_channel;
> > -static dev_t majordev = -1; /**< indicates major num for device */
> > +static dev_t majordev; /**< indicates major num for device */
> 
> I don't like this, please fix this up to handle the major number
> properly, no need for this -1 mess.  And you just broke the logic with
> this change, which isn't allowed in any patch, sorry.

The patch description is bad and the patch is not complete, but it
doesn't introduce a bug.

The -1 is never used.  By the time we call visorchipset_file_cleanup()
is called then majordev has been initialized to >= 0 so we can delete
the (MAJOR(majordev) >= 0) check.  We can also delete the "registered"
variable because visorchipset_file_cleanup() is never called unless
"registered" is true.

"registered" is set on successful module_init() and
visorchipset_file_cleanup() is only called from module_exit().

There is the problem that visorchipset_init() doesn't release any
resources on error.  But that's a separate issue and using globals like
"registered" is an ugly thing so it doesn't help.

regards,
dan carpenter

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ