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: <20190830000058.882feb357058437cddc71315@suse.de>
Date:   Fri, 30 Aug 2019 00:00:58 +0200
From:   Thomas Bogendoerfer <tbogendoerfer@...e.de>
To:     Jakub Kicinski <jakub.kicinski@...ronome.com>
Cc:     Ralf Baechle <ralf@...ux-mips.org>,
        Paul Burton <paul.burton@...s.com>,
        James Hogan <jhogan@...nel.org>,
        "David S. Miller" <davem@...emloft.net>,
        linux-mips@...r.kernel.org, linux-kernel@...r.kernel.org,
        netdev@...r.kernel.org
Subject: Re: [PATCH v2 net-next 05/15] net: sgi: ioc3-eth: allocate space
 for desc rings only once

On Thu, 29 Aug 2019 14:05:37 -0700
Jakub Kicinski <jakub.kicinski@...ronome.com> wrote:

> On Thu, 29 Aug 2019 17:50:03 +0200, Thomas Bogendoerfer wrote:
> > +		if (skb)
> > +			dev_kfree_skb_any(skb);
> 
> I think dev_kfree_skb_any() accepts NULL

yes, I'll drop the if

> > +
> > +	/* Allocate and rx ring.  4kb = 512 entries  */
> > +	ip->rxr = (unsigned long *)get_zeroed_page(GFP_ATOMIC);
> > +	if (!ip->rxr) {
> > +		pr_err("ioc3-eth: rx ring allocation failed\n");
> > +		err = -ENOMEM;
> > +		goto out_stop;
> > +	}
> > +
> > +	/* Allocate tx rings.  16kb = 128 bufs.  */
> > +	ip->txr = (struct ioc3_etxd *)__get_free_pages(GFP_KERNEL, 2);
> > +	if (!ip->txr) {
> > +		pr_err("ioc3-eth: tx ring allocation failed\n");
> > +		err = -ENOMEM;
> > +		goto out_stop;
> > +	}
> 
> Please just use kcalloc()/kmalloc_array() here,

both allocation will be replaced in patch 11 with dma_direct_alloc_pages.
So I hope I don't need to change it here.

Out of curiosity does kcalloc/kmalloc_array give me the same guarantees about
alignment ? rx ring needs to be 4KB aligned, tx ring 16KB aligned.

>, and make sure the flags
> are set to GFP_KERNEL whenever possible. Here and in ioc3_alloc_rings()
> it looks like GFP_ATOMIC is unnecessary.

yes, I'll change it

Thomas.

-- 
SUSE Software Solutions Germany GmbH
HRB 247165 (AG München)
Geschäftsführer: Felix Imendörffer

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ