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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180322201453.706b0ab8@bootlin.com>
Date:   Thu, 22 Mar 2018 20:14:53 +0100
From:   Maxime Chevallier <maxime.chevallier@...tlin.com>
To:     David Miller <davem@...emloft.net>
Cc:     netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        antoine.tenart@...tlin.com, thomas.petazzoni@...tlin.com,
        gregory.clement@...tlin.com, miquel.raynal@...tlin.com,
        nadavh@...vell.com, stefanc@...vell.com, ymarkman@...vell.com,
        mw@...ihalf.com
Subject: Re: [PATCH net-next v2] net: mvpp2: Don't use dynamic allocs for
 local variables

Hello David,

On Thu, 22 Mar 2018 14:47:09 -0400 (EDT),
David Miller <davem@...emloft.net> wrote :

> From: Maxime Chevallier <maxime.chevallier@...tlin.com>
> Date: Wed, 21 Mar 2018 16:14:00 +0100
> 
> > diff --git a/drivers/net/ethernet/marvell/mvpp2.c
> > b/drivers/net/ethernet/marvell/mvpp2.c index
> > 9bd35f2291d6..28e33e139178 100644 ---
> > a/drivers/net/ethernet/marvell/mvpp2.c +++
> > b/drivers/net/ethernet/marvell/mvpp2.c @@ -1913,16 +1913,11 @@
> > static void mvpp2_prs_sram_offset_set(struct mvpp2_prs_entry *pe, }
> >  
> >  /* Find parser flow entry */
> > -static struct mvpp2_prs_entry *mvpp2_prs_flow_find(struct mvpp2
> > *priv, int flow) +static int mvpp2_prs_flow_find(struct mvpp2
> > *priv, int flow) {
> > -	struct mvpp2_prs_entry *pe;
> > +	struct mvpp2_prs_entry pe;
> >  	int tid;
> >  
> > -	pe = kzalloc(sizeof(*pe), GFP_KERNEL);
> > -	if (!pe)
> > -		return NULL;
> > -	mvpp2_prs_tcam_lu_set(pe, MVPP2_PRS_LU_FLOWS);
> > -  
> 
> In order to be an equivalent change you must bzero out this 'pe'
> object on the stack.  You are only initializing the index member
> before passing it into other functions.

I agree that this is unclear, but the functions I pass these objects to
only need the index field to be set, and will fill the rest of the
object according to the underlying HW representation (these objects
mirror the HW configuration).

I can see that this is confusing, we might want to make the
mvpp2_prs_hw_read function more explicit about this.

Would comments explaning this be enough, or should I try another way to
make this cleaner ?

Thanks,

Maxime

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ