]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.17.10/scsi-sd_zbc-fix-variable-type-and-bogus-comment.patch
Linux 4.19.40
[thirdparty/kernel/stable-queue.git] / releases / 4.17.10 / scsi-sd_zbc-fix-variable-type-and-bogus-comment.patch
1 From f13cff6c25bd8986627365346d123312ee7baa78 Mon Sep 17 00:00:00 2001
2 From: Damien Le Moal <damien.lemoal@wdc.com>
3 Date: Tue, 3 Jul 2018 15:23:58 +0900
4 Subject: scsi: sd_zbc: Fix variable type and bogus comment
5
6 From: Damien Le Moal <damien.lemoal@wdc.com>
7
8 commit f13cff6c25bd8986627365346d123312ee7baa78 upstream.
9
10 Fix the description of sd_zbc_check_zone_size() to correctly explain that
11 the returned value is a number of device blocks, not bytes. Additionally,
12 the 32 bits "ret" variable used in this function may truncate the 64 bits
13 zone_blocks variable value upon return. To fix this, change "ret" type to
14 s64.
15
16 Fixes: ccce20fc79 ("sd_zbc: Avoid that resetting a zone fails sporadically")
17 Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
18 Cc: Bart Van Assche <bart.vanassche@wdc.com>
19 Cc: stable@kernel.org
20 Reviewed-by: Hannes Reinecke <hare@suse.com>
21 Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com>
22 Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
23 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
24
25 ---
26 drivers/scsi/sd_zbc.c | 5 +++--
27 1 file changed, 3 insertions(+), 2 deletions(-)
28
29 --- a/drivers/scsi/sd_zbc.c
30 +++ b/drivers/scsi/sd_zbc.c
31 @@ -401,7 +401,8 @@ static int sd_zbc_check_capacity(struct
32 * Check that all zones of the device are equal. The last zone can however
33 * be smaller. The zone size must also be a power of two number of LBAs.
34 *
35 - * Returns the zone size in bytes upon success or an error code upon failure.
36 + * Returns the zone size in number of blocks upon success or an error code
37 + * upon failure.
38 */
39 static s64 sd_zbc_check_zone_size(struct scsi_disk *sdkp)
40 {
41 @@ -411,7 +412,7 @@ static s64 sd_zbc_check_zone_size(struct
42 unsigned char *rec;
43 unsigned int buf_len;
44 unsigned int list_length;
45 - int ret;
46 + s64 ret;
47 u8 same;
48
49 /* Get a buffer */