From: Pavel Machek <pavel@denx.de>
To: Sasha Levin <sashal@kernel.org>
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
Filipe Manana <fdmanana@suse.com>, Qu Wenruo <wqu@suse.com>,
David Sterba <dsterba@suse.com>,
clm@fb.com, josef@toxicpanda.com, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH AUTOSEL 4.19 2/2] btrfs: fix warning on PTR_ERR() against NULL device at btrfs_control_ioctl()
Date: Mon, 2 Dec 2024 13:04:04 +0100 [thread overview]
Message-ID: <Z02iNPcVHpjPtHXR@duo.ucw.cz> (raw)
In-Reply-To: <20241124124231.3337202-2-sashal@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 1083 bytes --]
Hi!
> From: Filipe Manana <fdmanana@suse.com>
>
> [ Upstream commit 2342d6595b608eec94187a17dc112dd4c2a812fa ]
>
> Smatch complains about calling PTR_ERR() against a NULL pointer:
>
> fs/btrfs/super.c:2272 btrfs_control_ioctl() warn: passing zero to 'PTR_ERR'
>
> Fix this by calling PTR_ERR() against the device pointer only if it
> contains an error.
This patch was wrongly ported to 4.19. It is not needed there. Same
test is already performed 2 lines above.
Please drop.
BR,
Pavel
> +++ b/fs/btrfs/super.c
> @@ -2283,7 +2283,10 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
> &btrfs_root_fs_type);
> if (IS_ERR(device)) {
> mutex_unlock(&uuid_mutex);
> - ret = PTR_ERR(device);
> + if (IS_ERR(device))
> + ret = PTR_ERR(device);
> + else
> + ret = 0;
> break;
> }
> ret = !(device->fs_devices->num_devices ==
--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
prev parent reply other threads:[~2024-12-02 12:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-24 12:42 [PATCH AUTOSEL 4.19 1/2] s390/cpum_sf: Handle CPU hotplug remove during sampling Sasha Levin
2024-11-24 12:42 ` [PATCH AUTOSEL 4.19 2/2] btrfs: fix warning on PTR_ERR() against NULL device at btrfs_control_ioctl() Sasha Levin
2024-12-02 12:04 ` Pavel Machek [this message]
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=Z02iNPcVHpjPtHXR@duo.ucw.cz \
--to=pavel@denx.de \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=fdmanana@suse.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sashal@kernel.org \
--cc=stable@vger.kernel.org \
--cc=wqu@suse.com \
/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
all inboxes | Powered by JetHome®