Re: [PATCH] trace-cmd: Have tracecmd_msg_data_send() return zero on zero size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 22 Mar 2019 11:49:29 +0000
Slavomir Kaslev <kaslevs@xxxxxxxxxx> wrote:

> > diff --git a/tracecmd/trace-msg.c b/tracecmd/trace-msg.c
> > index 51d0ac8b..382bd766 100644
> > --- a/tracecmd/trace-msg.c
> > +++ b/tracecmd/trace-msg.c
> > @@ -590,6 +590,10 @@ int tracecmd_msg_data_send(struct
> > tracecmd_msg_handle *msg_handle,
> >  	int ret;
> >  	int count = 0;
> >  
> > +	/* Don't bother doing anything if there's nothing to do */
> > +	if (!size)
> > +		return 0;
> > +
> >  	tracecmd_msg_init(MSG_SEND_DATA, &msg);
> >  
> >  	msg.buf = malloc(MSG_MAX_DATA_LEN);  
> 
> Nice catch. Definitely a latent bug waiting for someone to step on it.
> 
> Reviewed-by: Slavomir Kaslev <kaslevs@xxxxxxxxxx>

Yeah, it tripped me up, as I had a box that crashed because of it.
Delaying the finishing of the testing. Which I'm rerunning now.

-- Steve



[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux