[PATCH] zram: Fix buffer size passed to strlcpy()

From: Matthias Kaehlcke
Date: Fri Jul 28 2017 - 13:13:32 EST


comp_algorithm_store() passes the size of the source buffer to strlcpy()
instead of the destination buffer size, fix this.

Signed-off-by: Matthias Kaehlcke <mka@xxxxxxxxxxxx>
---
drivers/block/zram/zram_drv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 856d5dc02451..7d2ddffad361 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -327,7 +327,7 @@ static ssize_t comp_algorithm_store(struct device *dev,
return -EBUSY;
}

- strlcpy(zram->compressor, compressor, sizeof(compressor));
+ strlcpy(zram->compressor, compressor, sizeof(zram->compressor));
up_write(&zram->init_lock);
return len;
}
--
2.14.0.rc0.400.g1c36432dff-goog