[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20171009183359.3267a870@gandalf.local.home>
Date: Mon, 9 Oct 2017 18:33:59 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Michael Sartain <mikesart@...tmail.com>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/5] trace-cmd: Fix NULL pointer being passed to memcpy
On Mon, 9 Oct 2017 16:27:10 -0600
Michael Sartain <mikesart@...tmail.com> wrote:
> > > - memcpy(option->data, data, size);
> > > +
> > > + /* Some IDs (like TRACECMD_OPTION_TRACECLOCK) pass NULL data */
> > > + if (data)
> > > + memcpy(option->data, data, size);
> >
> > Is this a problem, as when this happens, size should be zero. Does it
> > crash with data=NULL and size=0, or have you seen size not be zero?
>
> I got an ASAN warning, but you are correct - the size was 0 and it did
> not crash.
OK, but it's almost like dividing zero from zero. Can you send another
patch, but this time check if (size) instead of if (data).
-- Steve
Powered by blists - more mailing lists