DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] eal: fix unitialized data warning
@ 2019-11-27 22:32 Stephen Hemminger
  2019-11-29  8:25 ` [dpdk-dev] [dpdk-stable] " David Marchand
  2019-12-04 11:12 ` David Marchand
  0 siblings, 2 replies; 6+ messages in thread
From: Stephen Hemminger @ 2019-11-27 22:32 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, stable

Valgrind reports that eal interrupt thread is calling epoll_ctl
with uninitialized data.  Trivial to fix by initializing it.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/librte_eal/linux/eal/eal_interrupts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_eal/linux/eal/eal_interrupts.c b/lib/librte_eal/linux/eal/eal_interrupts.c
index 1955324d3045..2cd537ba4492 100644
--- a/lib/librte_eal/linux/eal/eal_interrupts.c
+++ b/lib/librte_eal/linux/eal/eal_interrupts.c
@@ -1045,7 +1045,7 @@ eal_intr_handle_interrupts(int pfd, unsigned totalfds)
 static __attribute__((noreturn)) void *
 eal_intr_thread_main(__rte_unused void *arg)
 {
-	struct epoll_event ev;
+	struct epoll_event ev = { };
 
 	/* host thread, never break out */
 	for (;;) {
-- 
2.20.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH] eal: fix unitialized data warning
  2019-11-27 22:32 [dpdk-dev] [PATCH] eal: fix unitialized data warning Stephen Hemminger
@ 2019-11-29  8:25 ` David Marchand
  2019-11-29 17:02   ` Stephen Hemminger
  2019-12-04 11:12 ` David Marchand
  1 sibling, 1 reply; 6+ messages in thread
From: David Marchand @ 2019-11-29  8:25 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev, dpdk stable

On Wed, Nov 27, 2019 at 11:32 PM Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> Valgrind reports that eal interrupt thread is calling epoll_ctl
> with uninitialized data.  Trivial to fix by initializing it.
>
> Fixes: af75078fece3 ("first public release")
> Cc: stable@dpdk.org
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  lib/librte_eal/linux/eal/eal_interrupts.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/librte_eal/linux/eal/eal_interrupts.c b/lib/librte_eal/linux/eal/eal_interrupts.c
> index 1955324d3045..2cd537ba4492 100644
> --- a/lib/librte_eal/linux/eal/eal_interrupts.c
> +++ b/lib/librte_eal/linux/eal/eal_interrupts.c
> @@ -1045,7 +1045,7 @@ eal_intr_handle_interrupts(int pfd, unsigned totalfds)
>  static __attribute__((noreturn)) void *
>  eal_intr_thread_main(__rte_unused void *arg)
>  {
> -       struct epoll_event ev;
> +       struct epoll_event ev = { };
>
>         /* host thread, never break out */
>         for (;;) {

typedef union epoll_data
{
  void *ptr;
  int fd;
  uint32_t u32;
  uint64_t u64;
} epoll_data_t;

struct epoll_event
{
  uint32_t events;      /* Epoll events */
  epoll_data_t data;    /* User data variable */
} __EPOLL_PACKED;


static __attribute__((noreturn)) void *
eal_intr_thread_main(__rte_unused void *arg)
{
        struct epoll_event ev;
[...]
                        ev.events = EPOLLIN | EPOLLPRI | EPOLLRDHUP | EPOLLHUP;
                        ev.data.fd = src->intr_handle.fd;
[...]
                        if (epoll_ctl(pfd, EPOLL_CTL_ADD,
                                        src->intr_handle.fd, &ev) < 0){

So the uninitialised part is because we only set an int in the union.
False positive from valgrind, but the fix is quite simple.

Acked-by: David Marchand <david.marchand@redhat.com>


-- 
David Marchand


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH] eal: fix unitialized data warning
  2019-11-29  8:25 ` [dpdk-dev] [dpdk-stable] " David Marchand
@ 2019-11-29 17:02   ` Stephen Hemminger
  0 siblings, 0 replies; 6+ messages in thread
From: Stephen Hemminger @ 2019-11-29 17:02 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, dpdk stable

On Fri, 29 Nov 2019 09:25:15 +0100
David Marchand <david.marchand@redhat.com> wrote:

> On Wed, Nov 27, 2019 at 11:32 PM Stephen Hemminger
> <stephen@networkplumber.org> wrote:
> >
> > Valgrind reports that eal interrupt thread is calling epoll_ctl
> > with uninitialized data.  Trivial to fix by initializing it.
> >
> > Fixes: af75078fece3 ("first public release")
> > Cc: stable@dpdk.org
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> > ---
> >  lib/librte_eal/linux/eal/eal_interrupts.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/librte_eal/linux/eal/eal_interrupts.c b/lib/librte_eal/linux/eal/eal_interrupts.c
> > index 1955324d3045..2cd537ba4492 100644
> > --- a/lib/librte_eal/linux/eal/eal_interrupts.c
> > +++ b/lib/librte_eal/linux/eal/eal_interrupts.c
> > @@ -1045,7 +1045,7 @@ eal_intr_handle_interrupts(int pfd, unsigned totalfds)
> >  static __attribute__((noreturn)) void *
> >  eal_intr_thread_main(__rte_unused void *arg)
> >  {
> > -       struct epoll_event ev;
> > +       struct epoll_event ev = { };
> >
> >         /* host thread, never break out */
> >         for (;;) {  
> 
> typedef union epoll_data
> {
>   void *ptr;
>   int fd;
>   uint32_t u32;
>   uint64_t u64;
> } epoll_data_t;
> 
> struct epoll_event
> {
>   uint32_t events;      /* Epoll events */
>   epoll_data_t data;    /* User data variable */
> } __EPOLL_PACKED;
> 
> 
> static __attribute__((noreturn)) void *
> eal_intr_thread_main(__rte_unused void *arg)
> {
>         struct epoll_event ev;
> [...]
>                         ev.events = EPOLLIN | EPOLLPRI | EPOLLRDHUP | EPOLLHUP;
>                         ev.data.fd = src->intr_handle.fd;
> [...]
>                         if (epoll_ctl(pfd, EPOLL_CTL_ADD,
>                                         src->intr_handle.fd, &ev) < 0){
> 
> So the uninitialised part is because we only set an int in the union.
> False positive from valgrind, but the fix is quite simple.
> 
> Acked-by: David Marchand <david.marchand@redhat.com>

Agreed it is a false positive because the kernel is not going to care about
the unused bits in the union. But I wanted to make the application
run clean under valgrind. Otherwise, it is hard to find the real warnings
in surrounding noise.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH] eal: fix unitialized data warning
  2019-11-27 22:32 [dpdk-dev] [PATCH] eal: fix unitialized data warning Stephen Hemminger
  2019-11-29  8:25 ` [dpdk-dev] [dpdk-stable] " David Marchand
@ 2019-12-04 11:12 ` David Marchand
  2019-12-04 12:17   ` Andrew Rybchenko
  1 sibling, 1 reply; 6+ messages in thread
From: David Marchand @ 2019-12-04 11:12 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev, dpdk stable

Fixed title s/unitialized/uninitialized/

On Wed, Nov 27, 2019 at 11:32 PM Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> Valgrind reports that eal interrupt thread is calling epoll_ctl
> with uninitialized data.  Trivial to fix by initializing it.

Added a note on it being a Valgrind false positive.


> Fixes: af75078fece3 ("first public release")
> Cc: stable@dpdk.org

> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: David Marchand <david.marchand@redhat.com>

Applied, thanks.


--
David Marchand


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH] eal: fix unitialized data warning
  2019-12-04 11:12 ` David Marchand
@ 2019-12-04 12:17   ` Andrew Rybchenko
  2019-12-04 12:31     ` David Marchand
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Rybchenko @ 2019-12-04 12:17 UTC (permalink / raw)
  To: David Marchand, Stephen Hemminger; +Cc: dev, dpdk stable

On 12/4/19 2:12 PM, David Marchand wrote:
> Fixed title s/unitialized/uninitialized/
> 
> On Wed, Nov 27, 2019 at 11:32 PM Stephen Hemminger
> <stephen@networkplumber.org> wrote:
>>
>> Valgrind reports that eal interrupt thread is calling epoll_ctl
>> with uninitialized data.  Trivial to fix by initializing it.
> 
> Added a note on it being a Valgrind false positive.
> 
> 
>> Fixes: af75078fece3 ("first public release")
>> Cc: stable@dpdk.org
> 
>> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> Acked-by: David Marchand <david.marchand@redhat.com>
> 
> Applied, thanks.

It breaks build on RHEL 7.6 gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36):

lib/librte_eal/linux/eal/eal_interrupts.c: In function
‘eal_intr_thread_main’:
lib/librte_eal/linux/eal/eal_interrupts.c:1048:9: error: missing
initializer for field ‘events’ of ‘struct epoll_event’
[-Werror=missing-field-initializers]
   struct epoll_event ev = { };
          ^
In file included from lib/librte_eal/linu/eal/eal_interrupts.c:15:0:
/usr/include/sys/epoll.h:89:12: note: ‘events’ declared here
    uint32_t events; /* Epoll events */
             ^


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH] eal: fix unitialized data warning
  2019-12-04 12:17   ` Andrew Rybchenko
@ 2019-12-04 12:31     ` David Marchand
  0 siblings, 0 replies; 6+ messages in thread
From: David Marchand @ 2019-12-04 12:31 UTC (permalink / raw)
  To: Andrew Rybchenko; +Cc: Stephen Hemminger, dev, dpdk stable

On Wed, Dec 4, 2019 at 1:17 PM Andrew Rybchenko
<arybchenko@solarflare.com> wrote:
>
> On 12/4/19 2:12 PM, David Marchand wrote:
> > Fixed title s/unitialized/uninitialized/
> >
> > On Wed, Nov 27, 2019 at 11:32 PM Stephen Hemminger
> > <stephen@networkplumber.org> wrote:
> >>
> >> Valgrind reports that eal interrupt thread is calling epoll_ctl
> >> with uninitialized data.  Trivial to fix by initializing it.
> >
> > Added a note on it being a Valgrind false positive.
> >
> >
> >> Fixes: af75078fece3 ("first public release")
> >> Cc: stable@dpdk.org
> >
> >> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> > Acked-by: David Marchand <david.marchand@redhat.com>
> >
> > Applied, thanks.
>
> It breaks build on RHEL 7.6 gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36):
>
> lib/librte_eal/linux/eal/eal_interrupts.c: In function
> ‘eal_intr_thread_main’:
> lib/librte_eal/linux/eal/eal_interrupts.c:1048:9: error: missing
> initializer for field ‘events’ of ‘struct epoll_event’
> [-Werror=missing-field-initializers]
>    struct epoll_event ev = { };
>           ^
> In file included from lib/librte_eal/linu/eal/eal_interrupts.c:15:0:
> /usr/include/sys/epoll.h:89:12: note: ‘events’ declared here
>     uint32_t events; /* Epoll events */
>              ^

Erf, indeed, I ran the tests on a different system than my laptop...
Need more coffee, those initializers are always a pain.
I'll go with a memset.

Best first commit for a release, I suppose.


--
David Marchand


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-12-04 12:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-27 22:32 [dpdk-dev] [PATCH] eal: fix unitialized data warning Stephen Hemminger
2019-11-29  8:25 ` [dpdk-dev] [dpdk-stable] " David Marchand
2019-11-29 17:02   ` Stephen Hemminger
2019-12-04 11:12 ` David Marchand
2019-12-04 12:17   ` Andrew Rybchenko
2019-12-04 12:31     ` David Marchand

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).