[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20121101175217.GJ29270@xanatos>
Date: Thu, 1 Nov 2012 10:52:17 -0700
From: Sarah Sharp <sarah.a.sharp@...ux.intel.com>
To: Sergei Shtylyov <sshtylyov@...sta.com>
Cc: Julius Werner <jwerner@...omium.org>, linux-kernel@...r.kernel.org,
linux-usb@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Vincent Palatin <vpalatin@...omium.org>
Subject: Re: [PATCH] xhci: fix null-pointer dereference when destroying
half-built segment rings
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-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists