On Wed, Dec 9, 2009 at 8:04 PM, Matthew Wilcox <matthew@xxxxxx> wrote: > > On Wed, Dec 09, 2009 at 07:52:19PM +0100, Bart Van Assche wrote: > > Fix a bug in the interpretation of the ADDITIONAL CDB LENGTH (add_cdb_len) > > field of SRP_CMD requests. According to the SRP specification, the layout > > of this single-byte field is as follows: > > * Bits 0 and 1 are reserved. > > * Bits 2 to 7 represent the ADDITIONAL CDB LENGTH field, symbolically > > represented as n. > > * Still according to the SRP specification, the ADDITIONAL CDB section > > takes 4*n bytes. > > Your interpretation of the SRP spec does seem to be correct, and I can > totally see how the original author of this code got it wrong. > > > - offset = cmd->add_cdb_len * 4; > > + offset = (cmd->add_cdb_len >> 2) * 4; > > Would this not be better written as: > > offset = cmd->add_cdb_len & ~3; I chose the former because of better readability for someone familiar with the specs. But I do not have a strong opinion about this -- more opinions are welcome. Bart. -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html