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:   Thu, 20 Aug 2020 19:56:20 +0100
From:   Alex Dewar <alex.dewar90@...il.com>
To:     Joe Perches <joe@...ches.com>
Cc:     Alex Dewar <alex.dewar90@...il.com>,
        Sathya Prakash <sathya.prakash@...adcom.com>,
        Sreekanth Reddy <sreekanth.reddy@...adcom.com>,
        Suganath Prabu Subramani 
        <suganath-prabu.subramani@...adcom.com>,
        MPT-FusionLinux.pdl@...adcom.com, linux-scsi@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] scsi: mptfusion: Remove unnecessarily casts

On Thu, Aug 20, 2020 at 11:53:58AM -0700, Joe Perches wrote:
> On Thu, 2020-08-20 at 19:05 +0100, Alex Dewar wrote:
> > In a number of places, the value returned from pci_alloc_consistent() is
> > unnecessarily cast from void*. Remove these casts.
> []
> > diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
> []
> > @@ -4975,7 +4975,7 @@ GetLanConfigPages(MPT_ADAPTER *ioc)
> >  
> >  	if (hdr.PageLength > 0) {
> >  		data_sz = hdr.PageLength * 4;
> > -		ppage0_alloc = (LANPage0_t *) pci_alloc_consistent(ioc->pcidev, data_sz, &page0_dma);
> > +		ppage0_alloc = pci_alloc_consistent(ioc->pcidev, data_sz, &page0_dma);
> >  		rc = -ENOMEM;
> >  		if (ppage0_alloc) {
> >  			memset((u8 *)ppage0_alloc, 0, data_sz);
> 
> If you are removing unnecessary casts, it'd be better to remove
> all of them in the same file or subsystem at once.
> 
> Also this memset and cast isn't actually necessary any more
> as pci_alloc_consistent already zeros memory.
> 
> etc...
> 

Good suggestion. Thanks for the feedback :-)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ