Skip to contentSkip to conversation

brd: Make rd_size argument static

PATCH Applied Jan Kara 2 participants 3 messages Oct 25, 2016

Subsystems (2)
lore
Share & tools
lore

Jan Kara

author
#0 lore raw

PATCH 1/2 brd: Make rd_size argument static

rd_size does not appear to be used outside of brd. Make it static.

---
 drivers/block/brd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/brd.c +1 -1
index 0c76d4016eeb..8b22e4a04918 100644
@@ -443,7 +443,7 @@ static int rd_nr = CONFIG_BLK_DEV_RAM_COUNT;
 module_param(rd_nr, int, S_IRUGO);
 MODULE_PARM_DESC(rd_nr, "Maximum number of brd devices");
 
-int rd_size = CONFIG_BLK_DEV_RAM_SIZE;
+static int rd_size = CONFIG_BLK_DEV_RAM_SIZE;
 module_param(rd_size, int, S_IRUGO);
 MODULE_PARM_DESC(rd_size, "Size of each RAM disk in kbytes.");
 
Signature · 1 line
2.6.6
author
#1 lore raw

PATCH 2/2 brd: Switch rd_size to unsigned long

Currently rd_size was int which lead to overflow and bogus device size once the requested ramdisk size was 1 TB or more. Although these days ramdisks with 1 TB size are mostly a mistake, the days when they are useful are not far.

---
 drivers/block/brd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/block/brd.c +2 -2
index 8b22e4a04918..6af087068ab3 100644
@@ -443,8 +443,8 @@ static int rd_nr = CONFIG_BLK_DEV_RAM_COUNT;
 module_param(rd_nr, int, S_IRUGO);
 MODULE_PARM_DESC(rd_nr, "Maximum number of brd devices");
 
-static int rd_size = CONFIG_BLK_DEV_RAM_SIZE;
-module_param(rd_size, int, S_IRUGO);
+static unsigned long rd_size = CONFIG_BLK_DEV_RAM_SIZE;
+module_param(rd_size, ulong, S_IRUGO);
 MODULE_PARM_DESC(rd_size, "Size of each RAM disk in kbytes.");
 
 static int max_part = 1;
Signature · 1 line
2.6.6
maintainer Applied
#2 lore raw
In reply to Jan Kara
Quoted 1 line · Jan Kara

rd_size does not appear to be used outside of brd. Make it static.

Applied both patches, thanks Jan.

Signature · 1 line
Jens Axboe