From: "Mrzyglod, DanielX T" <danielx.t.mrzyglod@intel.com>
To: Stephen Hemminger <stephen@networkplumber.org>,
"Kobylinski, MichalX" <michalx.kobylinski@intel.com>
Cc: "thomas.monjalon@6wind.com" <thomas.monjalon@6wind.com>,
"dev@dpdk.org" <dev@dpdk.org>,
"david.marchand@6wind.com" <david.marchand@6wind.com>
Subject: Re: [dpdk-dev] [PATCH] mem: fix overflowed return value
Date: Wed, 8 Jun 2016 11:40:33 +0000 [thread overview]
Message-ID: <7ADD74816B4C8A45B56203CBA65FE5A637791649@IRSMSX107.ger.corp.intel.com> (raw)
In-Reply-To: <20160422092434.00bc0c46@xeon-e3>
>-----Original Message-----
>From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen Hemminger
>Sent: Friday, April 22, 2016 6:25 PM
>To: Kobylinski, MichalX <michalx.kobylinski@intel.com>
>Cc: thomas.monjalon@6wind.com; dev@dpdk.org
>Subject: Re: [dpdk-dev] [PATCH] mem: fix overflowed return value
>
>On Fri, 22 Apr 2016 12:44:18 +0200
>Michal Kobylinski <michalx.kobylinski@intel.com> wrote:
>
>> Fix issue reported by Coverity.
>>
>> Coverity ID 13255: Overflowed return value: The return value will be too
>> small or even negative, likely resulting in unexpected behavior in a
>> caller that uses the return value. In rte_mem_virt2phy: An integer
>> overflow occurs, with the overflowed value used as the return value of
>> the function
>>
>> Fixes: 3097de6e6bfb ("mem: get physical address of any pointer")
>>
>> Signed-off-by: Michal Kobylinski <michalx.kobylinski@intel.com>
>> ---
>> lib/librte_eal/linuxapp/eal/eal_memory.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c
>b/lib/librte_eal/linuxapp/eal/eal_memory.c
>> index 5b9132c..6ceca5b 100644
>> --- a/lib/librte_eal/linuxapp/eal/eal_memory.c
>> +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
>> @@ -195,7 +195,7 @@ rte_mem_virt2phy(const void *virtaddr)
>> * the pfn (page frame number) are bits 0-54 (see
>> * pagemap.txt in linux Documentation)
>> */
>> - physaddr = ((page & 0x7fffffffffffffULL) * page_size)
>> + physaddr = (uint64_t)((page & 0x7fffffffffffffULL) * page_size)
>> + ((unsigned long)virtaddr % page_size);
>> close(fd);
>> return physaddr;
>
>I am not trusting any of these Coverity patches you are sending.
>It seems you think wraparound can be just fixed by casting, it can't
>From my point of view it's False Possitive there is no chance that page_size will be bigger than long.
Coverity Assume that page_size may be 18446744071562067968 but it can't.
Only for glibc<2.1 we probably should change page_size = getpagesize(); to page_size = sysconf(_SC_PAGESIZE);
May I change this Coverity to False Positive or I missed something ? What's your opinion ?
next prev parent reply other threads:[~2016-06-08 11:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-22 10:44 Michal Kobylinski
2016-04-22 16:24 ` Stephen Hemminger
2016-06-08 11:40 ` Mrzyglod, DanielX T [this message]
2016-06-28 8:06 ` Jastrzebski, MichalX K
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=7ADD74816B4C8A45B56203CBA65FE5A637791649@IRSMSX107.ger.corp.intel.com \
--to=danielx.t.mrzyglod@intel.com \
--cc=david.marchand@6wind.com \
--cc=dev@dpdk.org \
--cc=michalx.kobylinski@intel.com \
--cc=stephen@networkplumber.org \
--cc=thomas.monjalon@6wind.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).