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
| ||
|
Message-Id: <20211015233028.2167651-7-mcgrof@kernel.org> Date: Fri, 15 Oct 2021 16:30:25 -0700 From: Luis Chamberlain <mcgrof@...nel.org> To: axboe@...nel.dk, jejb@...ux.ibm.com, martin.petersen@...cle.com, agk@...hat.com, snitzer@...hat.com, colyli@...e.de, kent.overstreet@...il.com, boris.ostrovsky@...cle.com, jgross@...e.com, sstabellini@...nel.org, roger.pau@...rix.com, geert@...ux-m68k.org, ulf.hansson@...aro.org, tj@...nel.org, hare@...e.de, jdike@...toit.com, richard@....at, anton.ivanov@...bridgegreys.com, johannes.berg@...el.com, krisman@...labora.com, chris.obbard@...labora.com, thehajime@...il.com, zhuyifei1999@...il.com, haris.iqbal@...os.com, jinpu.wang@...os.com, miquel.raynal@...tlin.com, vigneshr@...com, linux-mtd@...ts.infradead.org Cc: linux-scsi@...r.kernel.org, dm-devel@...hat.com, linux-bcache@...r.kernel.org, xen-devel@...ts.xenproject.org, linux-m68k@...ts.linux-m68k.org, linux-um@...ts.infradead.org, linux-block@...r.kernel.org, linux-kernel@...r.kernel.org, Luis Chamberlain <mcgrof@...nel.org> Subject: [PATCH 6/9] m68k/emu/nfblock: add error handling support for add_disk() We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. Reviewed-by: Geert Uytterhoeven <geert@...ux-m68k.org> Acked-by: Geert Uytterhoeven <geert@...ux-m68k.org> Signed-off-by: Luis Chamberlain <mcgrof@...nel.org> --- arch/m68k/emu/nfblock.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/m68k/emu/nfblock.c b/arch/m68k/emu/nfblock.c index 9a8394e96388..4de5a6087034 100644 --- a/arch/m68k/emu/nfblock.c +++ b/arch/m68k/emu/nfblock.c @@ -100,6 +100,7 @@ static int __init nfhd_init_one(int id, u32 blocks, u32 bsize) { struct nfhd_device *dev; int dev_id = id - NFHD_DEV_OFFSET; + int err = -ENOMEM; pr_info("nfhd%u: found device with %u blocks (%u bytes)\n", dev_id, blocks, bsize); @@ -130,16 +131,20 @@ static int __init nfhd_init_one(int id, u32 blocks, u32 bsize) sprintf(dev->disk->disk_name, "nfhd%u", dev_id); set_capacity(dev->disk, (sector_t)blocks * (bsize / 512)); blk_queue_logical_block_size(dev->disk->queue, bsize); - add_disk(dev->disk); + err = add_disk(dev->disk); + if (err) + goto out_cleanup_disk; list_add_tail(&dev->list, &nfhd_list); return 0; +out_cleanup_disk: + blk_cleanup_disk(dev->disk); free_dev: kfree(dev); out: - return -ENOMEM; + return err; } static int __init nfhd_init(void) -- 2.30.2
Powered by blists - more mailing lists