Re: [PATCH] scsi: ensure the header peeked does not change in the actual message
From: Christoph Hellwig <hch@infradead.org>
Date: 2017-09-19 20:36:28
From: Christoph Hellwig <hch@infradead.org>
Date: 2017-09-19 20:36:28
On Tue, Sep 19, 2017 at 12:15:57PM -0400, Meng Xu wrote:
Hi Christoph, By saying not copying the byte twice, did you mean copy_from_user(req->cmd, sic->data + sizeof(opcode), cmdlen - sizeof(opcode)) ? Does it affect the how req->cmd will be used later? If no, I'll submit another patch as instructed.
No, do something like: req->cmd[0] = opcode; if (copy_from_user(req->cmd + 1, sic->data, cmdlen - 1)) goto error;