From: "Quentin Schulz" <quentin.schulz@streamunlimited.com>
To: Amitanand N Chikorde <Amitanand.Chikorde@kpit.com>
Cc: openembedded-core@lists.openembedded.org, raj.khem@gmail.com,
nisha.parrakat@kpit.com, anuj.chougule@kpit.com
Subject: Re: [OE-core] [meta-oe][sumo][PATCH] systemd: fix codesonar warnings
Date: Fri, 7 Aug 2020 16:48:57 +0200 [thread overview]
Message-ID: <20200807144857.izgmbikrdfe4gcld@qschulz> (raw)
In-Reply-To: <1596810707-16909-1-git-send-email-Amitanand.Chikorde@kpit.com>
Hi Amitanand,
On Fri, Aug 07, 2020 at 08:01:47PM +0530, Amitanand N Chikorde wrote:
> Fixed below systemd codesonar warnings.
> 1. isprint() and isspace() is invoked here with an argument of signed
> type char, but only has defined behavior for int arguments that are
> either representable as unsigned char or equal to the value
> of macro EOF(-1).
>
> As per codesonar report, in a number of libc implementations, isprint()
> and isspace() functions implemented using lookup tables (arrays):
> passing in a negative value can result in a read underrun.
>
> To avoid this unexpected behaviour, typecasted char type argument to
> unsigned char type.
>
> 2. "seqnum" defined, not initialized & used in device-private.c
> Intialized "seqnum" at definition.
>
> Signed-off-by: Amitanand <Amitanand.Chikorde@kpit.com>
> ---
> .../systemd/systemd_codesonar_warnings_fix.patch | 105 +++++++++++++++++++++
> meta/recipes-core/systemd/systemd_245.6.bb | 1 +
> 2 files changed, 106 insertions(+)
> create mode 100644 meta/recipes-core/systemd/systemd/systemd_codesonar_warnings_fix.patch
>
> diff --git a/meta/recipes-core/systemd/systemd/systemd_codesonar_warnings_fix.patch b/meta/recipes-core/systemd/systemd/systemd_codesonar_warnings_fix.patch
> new file mode 100644
> index 0000000..a62f968
> --- /dev/null
> +++ b/meta/recipes-core/systemd/systemd/systemd_codesonar_warnings_fix.patch
> @@ -0,0 +1,105 @@
> +systemd: fix codesonar warnings
> +
> +Fixed below systemd codesonar warnings.
> +1. isprint() and isspace() is invoked here with an argument of signed
> +type char, but only has defined behavior for int arguments that are
> +either representable as unsigned char or equal to the value
> +of macro EOF(-1).
> +
> +As per codesonar report, in a number of libc implementations, isprint()
> +and isspace() functions implemented using lookup tables (arrays):
> +passing in a negative value can result in a read underrun.
> +
> +To avoid this unexpected behaviour, typecasted char type argument to
> +unsigned char type.
> +
> +2. "seqnum" defined, not initialized & used in device-private.c
> +Intialized "seqnum" at definition.
> +
> +Upstream-Status: Pending
Part of 1. is a backport:
https://github.com/systemd/systemd/commit/e7e954243a17cceb5278aac6249ee0dcc119b1eb
so please backport the patch entirely.
And make separate patch(es) for the rest if they aren't already
merged upstream.
As for the content of the patch (if it's a patch candidate), I'll let
maintainers decide/review.
> +Signed-off-by: Amitanand N. Chikorde <Amitanand.Chikorde@kpit.com>
> +
> +--- origcode/src/libsystemd/sd-device/device-private.c 2020-07-09 18:05:13.744127907 +0530
> ++++ modifcode/src/libsystemd/sd-device/device-private.c 2020-07-09 18:01:56.494621945 +0530
Does this patch even apply correctly? c.f. origcode/modifcode
Cheers,
Quentin
next prev parent reply other threads:[~2020-08-07 14:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-07 14:31 [meta-oe][sumo][PATCH] systemd: fix codesonar warnings Amitanand N Chikorde
2020-08-07 14:48 ` Quentin Schulz [this message]
2020-08-07 15:02 ` ✗ patchtest: failure for systemd: Fix codesonar warnings (rev4) Patchwork
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=20200807144857.izgmbikrdfe4gcld@qschulz \
--to=quentin.schulz@streamunlimited.com \
--cc=Amitanand.Chikorde@kpit.com \
--cc=anuj.chougule@kpit.com \
--cc=nisha.parrakat@kpit.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=raj.khem@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.