mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ROMFS: fix length used with romfs_dev_strnlen() function
@ 2009-10-06  5:53 Mike Frysinger
  2009-10-06  8:55 ` David Howells
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Frysinger @ 2009-10-06  5:53 UTC (permalink / raw)
  To: David Howells, Andrew Morton; +Cc: linux-kernel, Bernd Schmidt

From: Bernd Schmidt <bernds_cb1@t-online.de>

An interestingly corrupted romfs file system exposed a problem with the
romfs_dev_strnlen function: it's passing the wrong value to its helpers.
Rather than limit the string to the length passed in by the callers, it
uses the size of the device as the limit.

Signed-off-by: Bernd Schmidt <bernds_cb1@t-online.de>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 fs/romfs/storage.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/romfs/storage.c b/fs/romfs/storage.c
index b3208ad..71e2b4d 100644
--- a/fs/romfs/storage.c
+++ b/fs/romfs/storage.c
@@ -253,11 +253,11 @@ ssize_t romfs_dev_strnlen(struct super_block *sb,
 
 #ifdef CONFIG_ROMFS_ON_MTD
 	if (sb->s_mtd)
-		return romfs_mtd_strnlen(sb, pos, limit);
+		return romfs_mtd_strnlen(sb, pos, maxlen);
 #endif
 #ifdef CONFIG_ROMFS_ON_BLOCK
 	if (sb->s_bdev)
-		return romfs_blk_strnlen(sb, pos, limit);
+		return romfs_blk_strnlen(sb, pos, maxlen);
 #endif
 	return -EIO;
 }
-- 
1.6.5.rc2


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

end of thread, other threads:[~2009-10-06  8:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-06  5:53 [PATCH] ROMFS: fix length used with romfs_dev_strnlen() function Mike Frysinger
2009-10-06  8:55 ` David Howells

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

all inboxes | Powered by JetHome®