diff mbox

[1/2] debugfs.c: the max length of debugfs argument is too short

Message ID 1374834657-17091-2-git-send-email-liezhi.yang@windriver.com
State Superseded, archived
Headers show

Commit Message

Robert Yang July 26, 2013, 10:30 a.m. UTC
The max length of debugfs argument is 256 which is too short, the
arguments are two paths, the PATH_MAX is 4096 according to
/usr/include/linux/limits.h, use 2048 (4096 / 2) is a reasonable value.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Acked-by: Darren Hart <dvhart@linux.intel.com>
---
 debugfs/debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Theodore Ts'o July 29, 2013, 2:37 a.m. UTC | #1
On Fri, Jul 26, 2013 at 06:30:56PM +0800, Robert Yang wrote:
> The max length of debugfs argument is 256 which is too short, the
> arguments are two paths, the PATH_MAX is 4096 according to
> /usr/include/linux/limits.h, use 2048 (4096 / 2) is a reasonable value.

I'd just use BUFSIZ (which is 8192 on Linux systems).  That's what the
ss library uses, and if you might have two paths and PATH_MAX is 4096,
2048 could easily be too small.

					- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Robert Yang July 29, 2013, 7:16 a.m. UTC | #2
Hi Ted,

Thanks, I will update it and send a V3.

// Robert

On 07/29/2013 10:37 AM, Theodore Ts'o wrote:
> On Fri, Jul 26, 2013 at 06:30:56PM +0800, Robert Yang wrote:
>> The max length of debugfs argument is 256 which is too short, the
>> arguments are two paths, the PATH_MAX is 4096 according to
>> /usr/include/linux/limits.h, use 2048 (4096 / 2) is a reasonable value.
>
> I'd just use BUFSIZ (which is 8192 on Linux systems).  That's what the
> ss library uses, and if you might have two paths and PATH_MAX is 4096,
> 2048 could easily be too small.
>
> 					- Ted
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c
index dcf16e2..b77d0b5 100644
--- a/debugfs/debugfs.c
+++ b/debugfs/debugfs.c
@@ -2300,7 +2300,7 @@  void do_dump_mmp(int argc EXT2FS_ATTR((unused)), char *argv[])
 static int source_file(const char *cmd_file, int ss_idx)
 {
 	FILE		*f;
-	char		buf[256];
+	char		buf[2048];
 	char		*cp;
 	int		exit_status = 0;
 	int		retval;