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: <cd22db94ad43f788b158d6633a5b26b9c0aee5ba.camel@perches.com>
Date:   Sun, 20 Sep 2020 00:28:38 -0700
From:   Joe Perches <joe@...ches.com>
To:     Christophe JAILLET <christophe.jaillet@...adoo.fr>,
        akpm@...ux-foundation.org, natechancellor@...il.com,
        geert+renesas@...der.be
Cc:     linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] lib/scatterlist: Avoid a double memset

On Sun, 2020-09-20 at 09:15 +0200, Christophe JAILLET wrote:
> 'sgl' is zeroed a few lines below in 'sg_init_table()'. There is no need to
> clear it twice.
> 
> Remove the redundant initialization.

I didn't look very thoroughly, but there are at least
a few more of these with kcalloc and kzalloc like

block/bsg-lib.c-        size_t sz = (sizeof(struct scatterlist) * req->nr_phys_segments);
block/bsg-lib.c-
block/bsg-lib.c-        BUG_ON(!req->nr_phys_segments);
block/bsg-lib.c-
block/bsg-lib.c-        buf->sg_list = kzalloc(sz, GFP_KERNEL);
block/bsg-lib.c-        if (!buf->sg_list)
block/bsg-lib.c-                return -ENOMEM;
block/bsg-lib.c:        sg_init_table(buf->sg_list, req->nr_phys_segments);
---
drivers/target/target_core_rd.c-		sg = kcalloc(sg_per_table + chain_entry, sizeof(*sg),
drivers/target/target_core_rd.c-				GFP_KERNEL);
drivers/target/target_core_rd.c-		if (!sg)
drivers/target/target_core_rd.c-			return -ENOMEM;
drivers/target/target_core_rd.c-
drivers/target/target_core_rd.c:		sg_init_table(sg, sg_per_table + chain_entry);
---
net/rds/rdma.c-		sg = kcalloc(nents, sizeof(*sg), GFP_KERNEL);
net/rds/rdma.c-		if (!sg) {
net/rds/rdma.c-			ret = -ENOMEM;
net/rds/rdma.c-			goto out;
net/rds/rdma.c-		}
net/rds/rdma.c-		WARN_ON(!nents);
net/rds/rdma.c:		sg_init_table(sg, nents);


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ