Use get_unaligned_be16() for reading the two bytes specifying the buffer length

to allow the compiler to generate better code for reading these two bytes.

BSD-signed-off-by: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3947 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2011-12-02 02:39:43 +00:00
parent 2dd1d93762
commit 4a3988e274
+1 -1
View File
@@ -933,7 +933,7 @@ static int scst_set_lun_not_supported_inquiry(struct scst_cmd *cmd)
}
if (cmd->bufflen == 0)
cmd->bufflen = min_t(int, 36, (cmd->cdb[3] << 8) | cmd->cdb[4]);
cmd->bufflen = min_t(int, 36, get_unaligned_be16(&cmd->cdb[3]));
cmd->sg = scst_alloc(cmd->bufflen, GFP_ATOMIC, &cmd->sg_cnt);
if (cmd->sg == NULL) {