Message ID | faae16612c163bd6e65cf3d629b0a3c65666821b.1680108414.git.johannes.thumshirn@wdc.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35409C74A5B for <linux-mm@archiver.kernel.org>; Wed, 29 Mar 2023 17:06:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C3B08900002; Wed, 29 Mar 2023 13:06:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BC48A280001; Wed, 29 Mar 2023 13:06:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A3E03900006; Wed, 29 Mar 2023 13:06:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 917C5900002 for <linux-mm@kvack.org>; Wed, 29 Mar 2023 13:06:46 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 6CD831C6125 for <linux-mm@kvack.org>; Wed, 29 Mar 2023 17:06:46 +0000 (UTC) X-FDA: 80622565212.28.F1ACA65 Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by imf21.hostedemail.com (Postfix) with ESMTP id 39E8D1C0021 for <linux-mm@kvack.org>; Wed, 29 Mar 2023 17:06:44 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b="K7XVsA/2"; spf=pass (imf21.hostedemail.com: domain of "prvs=445a3f1bb=johannes.thumshirn@wdc.com" designates 216.71.154.45 as permitted sender) smtp.mailfrom="prvs=445a3f1bb=johannes.thumshirn@wdc.com"; dmarc=pass (policy=quarantine) header.from=wdc.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1680109604; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ZAZJI3cszmYVH87/ojs4mDfrFkC7lyCVrVL/gBZqQsA=; b=mHA8dH4h7FH2r+oTtDCEeyaa0TTs5Y28ddSOvuvn8ZmMDA3gsMil12RBqz9MXFYyjvVOKK l5IZyZw96Fn95IxsvHxWvIPVFj8NaQKOL3dOt2R9SKVGd+73zAPYGAHyrUEReJUQ+/I7ti JhPEAVlz6QYv2aqnJQaAPAgfyuSosqE= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b="K7XVsA/2"; spf=pass (imf21.hostedemail.com: domain of "prvs=445a3f1bb=johannes.thumshirn@wdc.com" designates 216.71.154.45 as permitted sender) smtp.mailfrom="prvs=445a3f1bb=johannes.thumshirn@wdc.com"; dmarc=pass (policy=quarantine) header.from=wdc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1680109604; a=rsa-sha256; cv=none; b=YQG+DP5fgjN22ACqkYHgWOPfWEPlZDoGCP+02mkaomqSuYS3hZ0dOn7bKb8+R7Bd8l4003 MhBqD5YdCS87/88+4dfFb1P6N9BN7k6HQDSgm3w2592XJHNfRV/Ega/3dvdtR+KXz04gDB yyLyiQ4FdCED6puaP6iEdTN36YYlpDc= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1680109604; x=1711645604; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=wcbMmuj5KLOp188zkhhO4UTGZgDj+uEBsLMZXWyJQ1M=; b=K7XVsA/2NxqdQH5vTfQuGTF4pGJhS78m75kOkfTUu3e8bB8OXUVW0kaf U5kgoXQWKgYvrklPoXnP3pZ2F5bpmXjkQzvtnzEryzJaaPYcSzGf1NnbY pvkaSUqdqm/GiJuNhPMYOC6Q8HZeIXV8qBaRDINPTkUnXdv6wZcM9gXNw dTo7dhX98KVIzqhdBezQvhHh7apg4omcvHqu/BcLgFQHvj8NmAN59yUsY 0GFxhkIF/Huuj2di8gweqPoZu6415gKGAwHTkgiThJezYoHBDVId5Em6K 9uPA10cflq0kndujxTR8KYXENTVqnZOWtRrG7PWwnoFQO5ApS8yHpqD6W Q==; X-IronPort-AV: E=Sophos;i="5.98,301,1673884800"; d="scan'208";a="226807053" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 30 Mar 2023 01:06:43 +0800 IronPort-SDR: JWshrd1masj2QSXSAhKcpnZCZXMIXbkjpipewwhV0ltDOCabYOIRC2+kIK8icqanCRztInhcAs /0LsDJ28Tv2e64dCcCyNu7aRxzkDOPUSCiVbe34Byt2U9m5hZQ09au0TlDihweynQZtNTCa4K1 9cfdZmRBBCa71pgdaqTn7c4qKnSwsafR7zyhEWXz/8rJtltzMPLp/BHDQ261NwfoJMkLpAIZpf QzNDMCeuc87I8+KvN4sO83nDlam71sDR7/xghOvjEREYibbpcH/T3vSCbwrH4RoOmNcrgdKDGl E+E= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 29 Mar 2023 09:22:53 -0700 IronPort-SDR: K3LvTn2mgS4z3aUZiHti9nEkM7pjvbBH6ZS/kYcx3E/VzjPdX+tted0ood1vYEc+vc7pbp55fL 71ZnHrIDtp/LZ0g7xWSsFjKZVDSjmWu1MIOcddLaQ0QQ8DiFvqGt1SHDGt+30EdZYwUUss3ZJ5 KHpYJp5gqdZMg4wYwQ+fxuyfJ4v5Ag1shD0OnVsp1Xt+MyUCPRAm3nfZVTezAdIkfloHRGP7Kb R4SjVt0dhflNVTvL7W5jpm1ArkajddHLuecePRmkHp+nFFOhkLEqvaqFM/RyBRB4b76XC4/FNz P4E= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 29 Mar 2023 10:06:42 -0700 From: Johannes Thumshirn <johannes.thumshirn@wdc.com> To: Jens Axboe <axboe@kernel.dk> Cc: Christoph Hellwig <hch@lst.de>, Hannes Reinecke <hare@suse.de>, Chaitanya Kulkarni <kch@nvidia.com>, Damien Le Moal <damien.lemoal@wdc.com>, Ming Lei <ming.lei@redhat.com>, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, dm-devel@redhat.com, Song Liu <song@kernel.org>, linux-raid@vger.kernel.org, Mike Snitzer <snitzer@kernel.org>, Matthew Wilcox <willy@infradead.org>, Dave Kleikamp <shaggy@kernel.org>, jfs-discussion@lists.sourceforge.net, cluster-devel@redhat.com, Bob Peterson <rpeterso@redhat.com>, Andreas Gruenbacher <agruenba@redhat.com>, David Sterba <dsterba@suse.com>, linux-btrfs@vger.kernel.org, Johannes Thumshirn <johannes.thumshirn@wdc.com> Subject: [PATCH 08/19] btrfs: repair: use __bio_add_page for adding single page Date: Wed, 29 Mar 2023 10:05:54 -0700 Message-Id: <faae16612c163bd6e65cf3d629b0a3c65666821b.1680108414.git.johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <cover.1680108414.git.johannes.thumshirn@wdc.com> References: <cover.1680108414.git.johannes.thumshirn@wdc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 39E8D1C0021 X-Stat-Signature: w9pt5kstb95d88861cyy53nmyu9cwy1a X-Rspam-User: X-HE-Tag: 1680109604-919631 X-HE-Meta: U2FsdGVk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neC/7lbu3rJCmSh4cMJZCt167g/H/qdrbhoKcfIuhErKOIz3T5oFgQytXxJb3BleEVZWi8tt/LeZ6wmP/O9mttX/LBp/e41SejzZMuVB5GP8F+sa3Dvt0YJYNMC15/5IvAzjYdQ0Aq0bNUr7U4xaeadLF7efzhqzR1LN+0RwCOhY8zXp7RurdyXsabwxWm7duKv1NRicPNZUovF6t2+hMmCQhoL3j0neHhkqFpvlbXEhs+VNuM99zlRySB1g/hBt4xmlC/MXIBNN6vNQFy806bxs4p8VT8B/ELok4N/ZNJtJj/lA X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> |
Series |
bio: check return values of bio_add_page
|
expand
|
On 3/30/23 02:05, Johannes Thumshirn wrote: > The btrfs repair bio submission code uses bio_add_page() to add a page to > a newly created bio. bio_add_page() can fail, but the return value is > never checked. > > Use __bio_add_page() as adding a single page to a newly created bio is > guaranteed to succeed. > > This brings us a step closer to marking bio_add_page() as __must_check. > > Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c index 726592868e9c..73220a219c91 100644 --- a/fs/btrfs/bio.c +++ b/fs/btrfs/bio.c @@ -224,7 +224,7 @@ static struct btrfs_failed_bio *repair_one_sector(struct btrfs_bio *failed_bbio, repair_bio = bio_alloc_bioset(NULL, 1, REQ_OP_READ, GFP_NOFS, &btrfs_repair_bioset); repair_bio->bi_iter.bi_sector = failed_bbio->saved_iter.bi_sector; - bio_add_page(repair_bio, bv->bv_page, bv->bv_len, bv->bv_offset); + __bio_add_page(repair_bio, bv->bv_page, bv->bv_len, bv->bv_offset); repair_bbio = btrfs_bio(repair_bio); btrfs_bio_init(repair_bbio, failed_bbio->inode, NULL, fbio);
The btrfs repair bio submission code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to marking bio_add_page() as __must_check. Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> --- fs/btrfs/bio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)