]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
scsi: core: scsi_trace: Use get_unaligned_be*()
authorBart Van Assche <bvanassche@acm.org>
Fri, 1 Nov 2019 21:14:47 +0000 (14:14 -0700)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 14 Feb 2020 05:29:37 +0000 (00:29 -0500)
commiteeaf76c87b5adccb1fea4dd103ef587c4113d15c
tree3f81b691ebf6517548de6dfbba7bf388d290361f
parent3d381f9bd4e80769969ef7e1e3211cfbaef5ffba
scsi: core: scsi_trace: Use get_unaligned_be*()

BugLink: https://bugs.launchpad.net/bugs/1862259
commit b1335f5b0486f61fb66b123b40f8e7a98e49605d upstream.

This patch fixes an unintended sign extension on left shifts. From Colin
King: "Shifting a u8 left will cause the value to be promoted to an
integer. If the top bit of the u8 is set then the following conversion to
an u64 will sign extend the value causing the upper 32 bits to be set in
the result."

Fix this by using get_unaligned_be*() instead.

Fixes: bf8162354233 ("[SCSI] add scsi trace core functions and put trace points")
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Douglas Gilbert <dgilbert@interlog.com>
Link: https://lore.kernel.org/r/20191101211447.187151-1-bvanassche@acm.org
Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/scsi/scsi_trace.c