On Wed, 19 Jan 2011 10:08:59 -0600
Shirish Pargaonkar <[email protected]> wrote:


> >> @@ -158,19 +162,23 @@ cifs_from_ucs2(char *to, const __le16 *from, int 
> >> tolen, int fromlen,
> >>         */
> >>        safelen = tolen - (NLS_MAX_CHARSET_SIZE + nullsize);
> >>
> >> -       for (i = 0; i < fromwords && from[i]; i++) {
> >> +       for (i = 0; i < fromwords; i++) {
> >> +               ftmp = get_unaligned_le16(&from[i]);
> >> +               if (ftmp == 0)
> >> +                       break;
> >> +
> >
> > Can the contents of from[i] be 0 so ftmp is 0 but we did
> > not want to break out until fromwords?
> >
> 
> Basically, why_does/what_it_means get_unaligned_le16()
> returning 0 warrants breaking out of the loop!
> 

That means that we hit the NULL terminator in the "from" string (two
adjacent zero bytes). So, we absolutely want to break out there.

-- 
Jeff Layton <[email protected]>
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to