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]
Message-ID: <d5ff3e3cb7cb435a9eff8d159e85f704@AcuMS.aculab.com>
Date:   Wed, 14 Nov 2018 10:44:12 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'James Bottomley' <jejb@...ux.vnet.ibm.com>,
        Johannes Thumshirn <jthumshirn@...e.de>,
        John Garry <john.garry@...wei.com>,
        Sabyasachi Gupta <sabyasachi.linux@...il.com>,
        "satishkh@...co.com" <satishkh@...co.com>,
        "sebaddel@...co.com" <sebaddel@...co.com>,
        "kartilak@...co.com" <kartilak@...co.com>,
        "martin.petersen@...cle.com" <martin.petersen@...cle.com>
CC:     "jrdr.linux@...il.com" <jrdr.linux@...il.com>,
        "linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "brajeswar.linux@...il.com" <brajeswar.linux@...il.com>
Subject: RE: [PATCH] drivers/scsi/fnic/fnic_trace.c: Use vzalloc

From: James Bottomley
> Sent: 13 November 2018 16:11
> 
> On Tue, 2018-11-13 at 16:53 +0100, Johannes Thumshirn wrote:
> > On 13/11/2018 16:44, John Garry wrote:
> > > On 13/11/2018 15:08, Sabyasachi Gupta wrote:
> [...]
> > > > -    fnic_trace_buf_p = (unsigned long)vmalloc((trace_max_pages *
> > > > PAGE_SIZE));
> > > > +    fnic_trace_buf_p = (unsigned long)vzalloc((trace_max_pages *
> > > > +                                PAGE_SIZE));
> > >
> > > If you remove the extra brackets in vzalloc() argument then you may
> > > not spill onto the next line.
> >
> > And remove the unnecessary cast. vzalloc() (just like vmalloc())
> > returns a void*, so no reason to cast it.
> 
> This is incorrect advice: there's no need to cast it to other *pointer*
> types, but if you cast it to a non-pointer type (which this is doing)
> the compiler will complain if there is no explicit cast.

The real question is why is this code using 'unsigned long'
to hold pointers?

Never mind why it is allocating a large memory block then setting
up another array with pointers to every 64 bytes down it.

Also why default to 16 * PAGE_SIZE - that is silly if pages are big.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ