DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Burakov, Anatoly" <anatoly.burakov@intel.com>
To: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v3 2/2] eal: fix signed integers in fbarray
Date: Sat, 14 Apr 2018 11:03:50 +0100	[thread overview]
Message-ID: <e2100a0c-6b06-92e3-e52f-a98da7ef4810@intel.com> (raw)
In-Reply-To: <20180413183950.17625-2-adrien.mazarguil@6wind.com>

On 13-Apr-18 7:43 PM, Adrien Mazarguil wrote:
> While debugging startup issues encountered with Clang (see "eal: fix
> undefined behavior in fbarray"), I noticed that fbarray stores indices,
> sizes and masks on signed integers involved in bitwise operations.
> 
> Such operations almost invariably cause undefined behavior with values that
> cannot be represented by the result type, as is often the case with
> bit-masks and left-shifts.
> 
> This patch replaces them with unsigned integers as a safety measure and
> promotes a few internal variables to larger types for consistency.
> 
> Fixes: c44d09811b40 ("eal: add shared indexed file-backed array")
> Cc: Anatoly Burakov <anatoly.burakov@intel.com>
> 
> Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
> 
> --
> 
> v3 changes:
> 
> - Added INT_MAX upper bound check in fully_validate() as suggested by
>    Anatoly.
> - Added a sysconf() result check to appease Coverity since calc_data_size()
>    now takes an unsigned page size (Coverity issues 272598 and 272599).
> 
> v2 changes:
> 
> Removed unnecessary "(unsigned int)" cast leftovers.

Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

-- 
Thanks,
Anatoly

  reply	other threads:[~2018-04-14 10:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-13 15:39 [dpdk-dev] [PATCH 1/2] eal: fix undefined behavior " Adrien Mazarguil
2018-04-13 15:39 ` [dpdk-dev] [PATCH 2/2] eal: fix signed integers " Adrien Mazarguil
2018-04-13 15:56 ` [dpdk-dev] [PATCH v2 1/2] eal: fix undefined behavior " Adrien Mazarguil
2018-04-13 15:56   ` [dpdk-dev] [PATCH v2 2/2] eal: fix signed integers " Adrien Mazarguil
2018-04-13 16:09     ` Burakov, Anatoly
2018-04-13 17:54       ` Adrien Mazarguil
2018-04-13 16:10   ` [dpdk-dev] [PATCH v2 1/2] eal: fix undefined behavior " Burakov, Anatoly
2018-04-13 18:42   ` [dpdk-dev] [PATCH v3 " Adrien Mazarguil
2018-04-13 18:43     ` [dpdk-dev] [PATCH v3 2/2] eal: fix signed integers " Adrien Mazarguil
2018-04-14 10:03       ` Burakov, Anatoly [this message]
2018-04-17 11:14         ` Burakov, Anatoly
2018-04-17 12:39           ` Thomas Monjalon

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=e2100a0c-6b06-92e3-e52f-a98da7ef4810@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=adrien.mazarguil@6wind.com \
    --cc=dev@dpdk.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 NNTP newsgroup(s).