From: Adam Borowski <kilobyte@angband.pl>
To: David Sterba <dsterba@suse.cz>,
linux-btrfs@vger.kernel.org, Mark Fasheh <mfasheh@versity.com>
Cc: Adam Borowski <kilobyte@angband.pl>
Subject: [PATCH resend 1/2] btrfs-progs: fix kernel version parsing on some versions past 3.0
Date: Mon, 25 Feb 2019 19:16:43 +0100 [thread overview]
Message-ID: <20190225181644.10262-1-kilobyte@angband.pl> (raw)
The code fails if the third section is missing (like "4.18") or is followed
by anything but "." or "-". This happens for example if we're not exactly
at a tag and CONFIG_LOCALVERSION_AUTO=n (which results in "4.18.5+").
Signed-off-by: Adam Borowski <kilobyte@angband.pl>
---
fsfeatures.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/fsfeatures.c b/fsfeatures.c
index 13ad0308..68653739 100644
--- a/fsfeatures.c
+++ b/fsfeatures.c
@@ -216,11 +216,8 @@ u32 get_running_kernel_version(void)
return (u32)-1;
version |= atoi(tmp) << 8;
tmp = strtok_r(NULL, ".", &saveptr);
- if (tmp) {
- if (!string_is_numerical(tmp))
- return (u32)-1;
+ if (tmp && string_is_numerical(tmp))
version |= atoi(tmp);
- }
return version;
}
--
2.20.1
next reply other threads:[~2019-02-25 18:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-25 18:16 Adam Borowski [this message]
2019-02-25 18:16 ` [PATCH resend 2/2] btrfs-progs: defrag: open files RO on new enough kernels Adam Borowski
2019-03-05 13:30 ` David Sterba
2019-03-05 13:24 ` [PATCH resend 1/2] btrfs-progs: fix kernel version parsing on some versions past 3.0 David Sterba
-- strict thread matches above, loose matches on Subject: below --
2018-11-21 16:45 [PATCH RESEND " Adam Borowski
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=20190225181644.10262-1-kilobyte@angband.pl \
--to=kilobyte@angband.pl \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=mfasheh@versity.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;
as well as URLs for NNTP newsgroup(s).