On Wed, Jan 19, 2011 at 10:11 AM, Jeff Layton <jlayton@xxxxxxxxxx> wrote: > On Wed, 19 Jan 2011 09:58:45 -0600 > Shirish Pargaonkar <shirishpargaonkar@xxxxxxxxx> wrote: > >> On Tue, Jan 18, 2011 at 2:33 PM, Jeff Layton <jlayton@xxxxxxxxxx> wrote: >> > Make sure we use get/put_unaligned routines when accessing wide >> > character strings. >> > >> > Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx> > > [...] > >> > @@ -60,7 +64,7 @@ cifs_ucs2_bytes(const __le16 *from, int maxbytes, >> > /* >> > * cifs_mapchar - convert a little-endian char to proper char in codepage >> >> I think this wording is now incorrect since src_char is not le anymore. >> > > Good catch. I'll fix it. > > > [...] > >> > @@ -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? >> > > I don't quite understand what you're asking. The code should be > equivalent to what was there before except that we use > get_unaligned_le16 to get the value and store it in a variable on the > stack. Note that the '&& from[i]' condition was removed from the "for" > statement. > > > -- > Jeff Layton <jlayton@xxxxxxxxxx> > You are right, in that case I do not understand what it means to break out of the loop if the contents of from[i] is 0. So other than the comment part, rest looks correct. Reviewed-by: Shirish Pargaonkar <shirishpargaonkar@xxxxxxxxx> -- To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html