stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Mike Snitzer <snitzer@redhat.com>,
	Kent Overstreet <kent.overstreet@gmail.com>,
	Jens Axboe <axboe@kernel.dk>, Sasha Levin <sashal@kernel.org>
Subject: [PATCH 4.14 05/95] dm: Use kzalloc for all structs with embedded biosets/mempools
Date: Mon,  4 Nov 2019 22:44:03 +0100	[thread overview]
Message-ID: <20191104212040.275218135@linuxfoundation.org> (raw)
In-Reply-To: <20191104212038.056365853@linuxfoundation.org>

From: Kent Overstreet <kent.overstreet@gmail.com>

[ Upstream commit d377535405686f735b90a8ad4ba269484cd7c96e ]

mempool_init()/bioset_init() require that the mempools/biosets be zeroed
first; they probably should not _require_ this, but not allocating those
structs with kzalloc is a fairly nonsensical thing to do (calling
mempool_exit()/bioset_exit() on an uninitialized mempool/bioset is legal
and safe, but only works if said memory was zeroed.)

Acked-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/md/dm-bio-prison-v1.c | 2 +-
 drivers/md/dm-bio-prison-v2.c | 2 +-
 drivers/md/dm-io.c            | 2 +-
 drivers/md/dm-kcopyd.c        | 2 +-
 drivers/md/dm-region-hash.c   | 2 +-
 drivers/md/dm-snap.c          | 2 +-
 drivers/md/dm-thin.c          | 2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/md/dm-bio-prison-v1.c b/drivers/md/dm-bio-prison-v1.c
index 874841f0fc837..10532a76688ea 100644
--- a/drivers/md/dm-bio-prison-v1.c
+++ b/drivers/md/dm-bio-prison-v1.c
@@ -33,7 +33,7 @@ static struct kmem_cache *_cell_cache;
  */
 struct dm_bio_prison *dm_bio_prison_create(void)
 {
-	struct dm_bio_prison *prison = kmalloc(sizeof(*prison), GFP_KERNEL);
+	struct dm_bio_prison *prison = kzalloc(sizeof(*prison), GFP_KERNEL);
 
 	if (!prison)
 		return NULL;
diff --git a/drivers/md/dm-bio-prison-v2.c b/drivers/md/dm-bio-prison-v2.c
index 8ce3a1a588cfd..c34ec615420f2 100644
--- a/drivers/md/dm-bio-prison-v2.c
+++ b/drivers/md/dm-bio-prison-v2.c
@@ -35,7 +35,7 @@ static struct kmem_cache *_cell_cache;
  */
 struct dm_bio_prison_v2 *dm_bio_prison_create_v2(struct workqueue_struct *wq)
 {
-	struct dm_bio_prison_v2 *prison = kmalloc(sizeof(*prison), GFP_KERNEL);
+	struct dm_bio_prison_v2 *prison = kzalloc(sizeof(*prison), GFP_KERNEL);
 
 	if (!prison)
 		return NULL;
diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c
index b4357ed4d5416..56e2c0e079d78 100644
--- a/drivers/md/dm-io.c
+++ b/drivers/md/dm-io.c
@@ -50,7 +50,7 @@ struct dm_io_client *dm_io_client_create(void)
 	struct dm_io_client *client;
 	unsigned min_ios = dm_get_reserved_bio_based_ios();
 
-	client = kmalloc(sizeof(*client), GFP_KERNEL);
+	client = kzalloc(sizeof(*client), GFP_KERNEL);
 	if (!client)
 		return ERR_PTR(-ENOMEM);
 
diff --git a/drivers/md/dm-kcopyd.c b/drivers/md/dm-kcopyd.c
index bd9a45b94b552..7ca2b1aaa79d4 100644
--- a/drivers/md/dm-kcopyd.c
+++ b/drivers/md/dm-kcopyd.c
@@ -892,7 +892,7 @@ struct dm_kcopyd_client *dm_kcopyd_client_create(struct dm_kcopyd_throttle *thro
 	int r = -ENOMEM;
 	struct dm_kcopyd_client *kc;
 
-	kc = kmalloc(sizeof(*kc), GFP_KERNEL);
+	kc = kzalloc(sizeof(*kc), GFP_KERNEL);
 	if (!kc)
 		return ERR_PTR(-ENOMEM);
 
diff --git a/drivers/md/dm-region-hash.c b/drivers/md/dm-region-hash.c
index 85c32b22a420a..91c6f6d72eeec 100644
--- a/drivers/md/dm-region-hash.c
+++ b/drivers/md/dm-region-hash.c
@@ -179,7 +179,7 @@ struct dm_region_hash *dm_region_hash_create(
 		;
 	nr_buckets >>= 1;
 
-	rh = kmalloc(sizeof(*rh), GFP_KERNEL);
+	rh = kzalloc(sizeof(*rh), GFP_KERNEL);
 	if (!rh) {
 		DMERR("unable to allocate region hash memory");
 		return ERR_PTR(-ENOMEM);
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index 95c564b60d79a..2170f6c118b89 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -1136,7 +1136,7 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 		origin_mode = FMODE_WRITE;
 	}
 
-	s = kmalloc(sizeof(*s), GFP_KERNEL);
+	s = kzalloc(sizeof(*s), GFP_KERNEL);
 	if (!s) {
 		ti->error = "Cannot allocate private snapshot structure";
 		r = -ENOMEM;
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index aa77959909894..0ee5eae716909 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -2962,7 +2962,7 @@ static struct pool *pool_create(struct mapped_device *pool_md,
 		return (struct pool *)pmd;
 	}
 
-	pool = kmalloc(sizeof(*pool), GFP_KERNEL);
+	pool = kzalloc(sizeof(*pool), GFP_KERNEL);
 	if (!pool) {
 		*error = "Error allocating memory for pool";
 		err_p = ERR_PTR(-ENOMEM);
-- 
2.20.1




  parent reply	other threads:[~2019-11-04 22:24 UTC|newest]

Thread overview: 102+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-04 21:43 [PATCH 4.14 00/95] 4.14.152-stable review Greg Kroah-Hartman
2019-11-04 21:43 ` [PATCH 4.14 01/95] zram: fix race between backing_dev_show and backing_dev_store Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 02/95] dm snapshot: use mutex instead of rw_semaphore Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 03/95] dm snapshot: introduce account_start_copy() and account_end_copy() Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 04/95] dm snapshot: rework COW throttling to fix deadlock Greg Kroah-Hartman
2019-11-04 21:44 ` Greg Kroah-Hartman [this message]
2019-11-04 21:44 ` [PATCH 4.14 06/95] f2fs: flush quota blocks after turnning it off Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 07/95] scsi: lpfc: Fix a duplicate 0711 log message number Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 08/95] sc16is7xx: Fix for "Unexpected interrupt: 8" Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 09/95] powerpc/powernv: hold device_hotplug_lock when calling memtrace_offline_pages() Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 10/95] HID: i2c-hid: add Direkt-Tek DTLAPY133-1 to descriptor override Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 11/95] x86/cpu: Add Atom Tremont (Jacobsville) Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 12/95] HID: i2c-hid: Add Odys Winbook 13 to descriptor override Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 13/95] clk: boston: unregister clks on failure in clk_boston_setup() Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 14/95] scripts/setlocalversion: Improve -dirty check with git-status --no-optional-locks Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 15/95] HID: Add ASUS T100CHI keyboard dock battery quirks Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 16/95] usb: handle warm-reset port requests on hub resume Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 17/95] rtc: pcf8523: set xtal load capacitance from DT Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 18/95] mlxsw: spectrum: Set LAG port collector only when active Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 19/95] ALSA: hda/realtek - Apply ALC294 hp init also for S4 resume Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 20/95] media: vimc: Remove unused but set variables Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 21/95] exec: load_script: Do not exec truncated interpreter path Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 22/95] PCI/PME: Fix possible use-after-free on remove Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 23/95] power: supply: max14656: fix potential use-after-free Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 24/95] iio: adc: meson_saradc: Fix memory allocation order Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 25/95] iio: fix center temperature of bmc150-accel-core Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 26/95] libsubcmd: Make _FORTIFY_SOURCE defines dependent on the feature Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 27/95] perf tests: Avoid raising SEGV using an obvious NULL dereference Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 28/95] perf map: Fix overlapped map handling Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 29/95] perf jevents: Fix period for Intel fixed counters Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 30/95] staging: rtl8188eu: fix null dereference when kzalloc fails Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 31/95] RDMA/hfi1: Prevent memory leak in sdma_init Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 32/95] RDMA/iwcm: Fix a lock inversion issue Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 33/95] HID: hyperv: Use in-place iterator API in the channel callback Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 34/95] nfs: Fix nfsi->nrequests count error on nfs_inode_remove_request Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 35/95] arm64: ftrace: Ensure synchronisation in PLT setup for Neoverse-N1 #1542419 Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 36/95] tty: serial: owl: Fix the link time qualifier of owl_uart_exit() Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 37/95] tty: n_hdlc: fix build on SPARC Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 38/95] gpio: max77620: Use correct unit for debounce times Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 39/95] fs: cifs: mute -Wunused-const-variable message Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 40/95] serial: mctrl_gpio: Check for NULL pointer Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 41/95] efi/cper: Fix endianness of PCIe class code Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 42/95] efi/x86: Do not clean dummy variable in kexec path Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 43/95] MIPS: include: Mark __cmpxchg as __always_inline Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 44/95] x86/xen: Return from panic notifier Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 45/95] ocfs2: clear zero in unaligned direct IO Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 46/95] fs: ocfs2: fix possible null-pointer dereferences in ocfs2_xa_prepare_entry() Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 47/95] fs: ocfs2: fix a possible null-pointer dereference in ocfs2_write_end_nolock() Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 48/95] fs: ocfs2: fix a possible null-pointer dereference in ocfs2_info_scan_inode_alloc() Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 49/95] sched/vtime: Fix guest/system mis-accounting on task switch Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 50/95] perf/x86/amd: Change/fix NMI latency mitigation to use a timestamp Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 51/95] MIPS: include: Mark __xchg as __always_inline Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 52/95] MIPS: fw: sni: Fix out of bounds init of o32 stack Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 53/95] nbd: fix possible sysfs duplicate warning Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 54/95] NFSv4: Fix leak of clp->cl_acceptor string Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 55/95] s390/uaccess: avoid (false positive) compiler warnings Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 56/95] tracing: Initialize iter->seq after zeroing in tracing_read_pipe() Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 57/95] nbd: verify socket is supported during setup Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 58/95] USB: legousbtower: fix a signedness bug in tower_probe() Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 59/95] net_sched: check cops->tcf_block in tc_bind_tclass() Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 60/95] thunderbolt: Use 32-bit writes when writing ring producer/consumer Greg Kroah-Hartman
2019-11-04 21:44 ` [PATCH 4.14 61/95] ath6kl: fix a NULL-ptr-deref bug in ath6kl_usb_alloc_urb_from_pipe() Greg Kroah-Hartman
2019-11-04 21:45 ` [PATCH 4.14 62/95] fuse: flush dirty data/metadata before non-truncate setattr Greg Kroah-Hartman
2019-11-04 21:45 ` [PATCH 4.14 63/95] fuse: truncate pending writes on O_TRUNC Greg Kroah-Hartman
2019-11-04 21:45 ` [PATCH 4.14 64/95] ALSA: bebob: Fix prototype of helper function to return negative value Greg Kroah-Hartman
2019-11-04 21:45 ` [PATCH 4.14 65/95] ALSA: hda/realtek - Fix 2 front mics of codec 0x623 Greg Kroah-Hartman
2019-11-04 21:45 ` [PATCH 4.14 66/95] ALSA: hda/realtek - Add support for ALC623 Greg Kroah-Hartman
2019-11-04 21:45 ` [PATCH 4.14 67/95] UAS: Revert commit 3ae62a42090f ("UAS: fix alignment of scatter/gather segments") Greg Kroah-Hartman
2019-11-05 14:33   ` Oliver Neukum
2019-11-04 21:45 ` [PATCH 4.14 68/95] USB: gadget: Reject endpoints with 0 maxpacket value Greg Kroah-Hartman
2019-11-04 21:45 ` [PATCH 4.14 69/95] usb-storage: Revert commit 747668dbc061 ("usb-storage: Set virt_boundary_mask to avoid SG overflows") Greg Kroah-Hartman
2019-11-04 21:45 ` [PATCH 4.14 70/95] USB: ldusb: fix ring-buffer locking Greg Kroah-Hartman
2019-11-04 21:45 ` [PATCH 4.14 71/95] USB: ldusb: fix control-message timeout Greg Kroah-Hartman
2019-11-04 21:45 ` [PATCH 4.14 72/95] USB: serial: whiteheat: fix potential slab corruption Greg Kroah-Hartman
2019-11-04 21:45 ` [PATCH 4.14 73/95] USB: serial: whiteheat: fix line-speed endianness Greg Kroah-Hartman
2019-11-04 21:45 ` [PATCH 4.14 74/95] scsi: target: cxgbit: Fix cxgbit_fw4_ack() Greg Kroah-Hartman
2019-11-04 21:45 ` [PATCH 4.14 75/95] HID: i2c-hid: add Trekstor Primebook C11B to descriptor override Greg Kroah-Hartman
2019-11-04 21:45 ` [PATCH 4.14 76/95] HID: Fix assumption that devices have inputs Greg Kroah-Hartman
2019-11-04 21:45 ` [PATCH 4.14 77/95] HID: fix error message in hid_open_report() Greg Kroah-Hartman
2019-11-04 21:45 ` [PATCH 4.14 78/95] nl80211: fix validation of mesh path nexthop Greg Kroah-Hartman
2019-11-04 21:45 ` [PATCH 4.14 79/95] s390/cmm: fix information leak in cmm_timeout_handler() Greg Kroah-Hartman
2019-11-04 21:45 ` [PATCH 4.14 80/95] s390/idle: fix cpu idle time calculation Greg Kroah-Hartman
2019-11-04 21:45 ` [PATCH 4.14 81/95] arm64: Ensure VM_WRITE|VM_SHARED ptes are clean by default Greg Kroah-Hartman
2019-11-04 21:45 ` [PATCH 4.14 82/95] rtlwifi: Fix potential overflow on P2P code Greg Kroah-Hartman
2019-11-04 21:45 ` [PATCH 4.14 83/95] dmaengine: cppi41: Fix cppi41_dma_prep_slave_sg() when idle Greg Kroah-Hartman
2019-11-04 21:45 ` [PATCH 4.14 84/95] llc: fix sk_buff leak in llc_sap_state_process() Greg Kroah-Hartman
2019-11-04 21:45 ` [PATCH 4.14 85/95] llc: fix sk_buff leak in llc_conn_service() Greg Kroah-Hartman
2019-11-04 21:45 ` [PATCH 4.14 86/95] rxrpc: Fix call ref leak Greg Kroah-Hartman
2019-11-04 21:45 ` [PATCH 4.14 87/95] NFC: pn533: fix use-after-free and memleaks Greg Kroah-Hartman
2019-11-04 21:45 ` [PATCH 4.14 88/95] bonding: fix potential NULL deref in bond_update_slave_arr Greg Kroah-Hartman
2019-11-04 21:45 ` [PATCH 4.14 89/95] net: usb: sr9800: fix uninitialized local variable Greg Kroah-Hartman
2019-11-04 21:45 ` [PATCH 4.14 90/95] sch_netem: fix rcu splat in netem_enqueue() Greg Kroah-Hartman
2019-11-04 21:45 ` [PATCH 4.14 91/95] sctp: fix the issue that flags are ignored when using kernel_connect Greg Kroah-Hartman
2019-11-04 21:45 ` [PATCH 4.14 92/95] sctp: not bind the socket in sctp_connect Greg Kroah-Hartman
2019-11-04 21:45 ` [PATCH 4.14 93/95] xfs: Correctly invert xfs_buftarg LRU isolation logic Greg Kroah-Hartman
2019-11-04 21:45 ` [PATCH 4.14 94/95] ALSA: timer: Simplify error path in snd_timer_open() Greg Kroah-Hartman
2019-11-04 21:45 ` [PATCH 4.14 95/95] ALSA: timer: Fix mutex deadlock at releasing card Greg Kroah-Hartman
2019-11-05  1:36 ` [PATCH 4.14 00/95] 4.14.152-stable review kernelci.org bot
2019-11-05  6:10 ` Naresh Kamboju
2019-11-05 14:25 ` Guenter Roeck
2019-11-05 16:53 ` shuah
2019-11-05 23:37 ` Jon Hunter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191104212040.275218135@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=axboe@kernel.dk \
    --cc=kent.overstreet@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sashal@kernel.org \
    --cc=snitzer@redhat.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).