From: Stefano Stabellini <sstabellini@kernel.org>
To: xen-devel@lists.xenproject.org
Cc: sstabellini@kernel.org, "Roger Pau Monné" <roger.pau@citrix.com>,
jbeulich@suse.com, "Andrew Cooper" <andrew.cooper3@citrix.com>,
"Bertrand Marquis" <bertrand.marquis@arm.com>,
"Michal Orzel" <michal.orzel@amd.com>,
"Julien Grall" <julien@xen.org>
Subject: [PATCH] lib/strtoul: fix MISRA R10.2 violation
Date: Mon, 13 May 2024 17:32:03 -0700 (PDT) [thread overview]
Message-ID: <alpine.DEB.2.22.394.2405131729180.2544314@ubuntu-linux-20-04-desktop> (raw)
Fix last violation of R10.2 by casting the result of toupper to plain
char. Note that we don't want to change toupper itself as it is a legacy
interface and it would cause more issues.
Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
---
I believe this is the last R10.2 violation
diff --git a/xen/lib/strtoul.c b/xen/lib/strtoul.c
index a378fe735e..345dcf9d8c 100644
--- a/xen/lib/strtoul.c
+++ b/xen/lib/strtoul.c
@@ -38,7 +38,7 @@ unsigned long simple_strtoul(
while ( isxdigit(*cp) &&
(value = isdigit(*cp) ? *cp - '0'
- : toupper(*cp) - 'A' + 10) < base )
+ : (char)toupper(*cp) - 'A' + 10) < base )
{
result = result * base + value;
cp++;
next reply other threads:[~2024-05-14 0:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-14 0:32 Stefano Stabellini [this message]
2024-05-14 8:46 ` [PATCH] lib/strtoul: fix MISRA R10.2 violation Jan Beulich
2024-05-14 22:52 ` Stefano Stabellini
2024-05-15 6:24 ` Jan Beulich
2024-05-15 22:47 ` Stefano Stabellini
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=alpine.DEB.2.22.394.2405131729180.2544314@ubuntu-linux-20-04-desktop \
--to=sstabellini@kernel.org \
--cc=andrew.cooper3@citrix.com \
--cc=bertrand.marquis@arm.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=roger.pau@citrix.com \
--cc=xen-devel@lists.xenproject.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 read-only IMAP folder(s) and NNTP newsgroup(s).