Re: [PATCH] xhci: fix null-pointer dereference when destroying half-built segment rings

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

 



On Mon, Oct 29, 2012 at 09:35:15PM +0300, Sergei Shtylyov wrote:
> Hello.
> 
> On 10/29/2012 08:00 PM, Julius Werner wrote:
> >  		next = xhci_segment_alloc(xhci, cycle_state, flags);
> >  		if (!next) {
> > -			xhci_free_segments_for_ring(xhci, *first);
> > +			prev = *first;
> > +			do {
> > +				next = prev->next;
> > +				xhci_segment_free(xhci, prev);
> > +			} while ((prev = next));
> 
>    It's preferred that the assignments are done outside the *if* and *while*
> statements. In fact, at least for the *if* statements scripts/checkpatch.pl
> gives a warning (it was silent in this case).

Hi Julius,

I agree with Sergei (for once).  The assignment in the while conditional
is confusing, and everyone reading the code will wonder if you meant
(prev == next).  Putting extra parenthesis around it to avoid static
type checker warnings is kind of missing the point.

Your patch does apply fine with git-am, so don't worry about the line
endings.  Can you please move the assignment into the loop and resubmit
this patch?

Sarah Sharp
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux