public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] zram: Fix buffer size passed to strlcpy()
@ 2017-07-28 17:12 Matthias Kaehlcke
  2017-08-02 22:54 ` Doug Anderson
  0 siblings, 1 reply; 4+ messages in thread
From: Matthias Kaehlcke @ 2017-07-28 17:12 UTC (permalink / raw)
  To: Minchan Kim, Nitin Gupta, Sergey Senozhatsky
  Cc: linux-kernel, Doug Anderson, Matthias Kaehlcke

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@chromium.org>
---
 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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-08-02 23:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-28 17:12 [PATCH] zram: Fix buffer size passed to strlcpy() Matthias Kaehlcke
2017-08-02 22:54 ` Doug Anderson
2017-08-02 23:44   ` Minchan Kim
2017-08-02 23:59     ` Matthias Kaehlcke

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox