diff options
author | OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> | 2007-07-16 02:39:56 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-16 12:05:42 -0400 |
commit | 9aacd599342fdfc1fb9422f37e900609b7a46249 (patch) | |
tree | 45c835330122496dfd51b946890ce8580d854173 /fs/fat | |
parent | 259902ea951008bcbd31a49f667062ff8012ef55 (diff) |
fat: gcc 4.3 warning fix
This patch fixes the following warnings.
fs/fat/dir.c: In function 'fat_parse_long':
include/linux/msdos_fs.h:294: warning: array subscript is above array bounds
include/linux/msdos_fs.h:295: warning: array subscript is above array bounds
include/linux/msdos_fs.h:295: warning: array subscript is above array bounds
The ->name is defined as "name[8], ext[3]", but fat_checksum() uses
those as name[11]. There is no actual problem, but it's not a good manner.
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/fat')
-rw-r--r-- | fs/fat/dir.c | 31 | ||||
-rw-r--r-- | fs/fat/inode.c | 3 |
2 files changed, 19 insertions, 15 deletions
diff --git a/fs/fat/dir.c b/fs/fat/dir.c index ccf161dffb63..72cbcd61bd95 100644 --- a/fs/fat/dir.c +++ b/fs/fat/dir.c | |||
@@ -313,7 +313,7 @@ int fat_search_long(struct inode *inode, const unsigned char *name, | |||
313 | wchar_t bufuname[14]; | 313 | wchar_t bufuname[14]; |
314 | unsigned char xlate_len, nr_slots; | 314 | unsigned char xlate_len, nr_slots; |
315 | wchar_t *unicode = NULL; | 315 | wchar_t *unicode = NULL; |
316 | unsigned char work[8], bufname[260]; /* 256 + 4 */ | 316 | unsigned char work[MSDOS_NAME], bufname[260]; /* 256 + 4 */ |
317 | int uni_xlate = sbi->options.unicode_xlate; | 317 | int uni_xlate = sbi->options.unicode_xlate; |
318 | int utf8 = sbi->options.utf8; | 318 | int utf8 = sbi->options.utf8; |
319 | int anycase = (sbi->options.name_check != 's'); | 319 | int anycase = (sbi->options.name_check != 's'); |
@@ -351,7 +351,8 @@ parse_record: | |||
351 | if (work[0] == 0x05) | 351 | if (work[0] == 0x05) |
352 | work[0] = 0xE5; | 352 | work[0] = 0xE5; |
353 | for (i = 0, j = 0, last_u = 0; i < 8;) { | 353 | for (i = 0, j = 0, last_u = 0; i < 8;) { |
354 | if (!work[i]) break; | 354 | if (!work[i]) |
355 | break; | ||
355 | chl = fat_shortname2uni(nls_disk, &work[i], 8 - i, | 356 | chl = fat_shortname2uni(nls_disk, &work[i], 8 - i, |
356 | &bufuname[j++], opt_shortname, | 357 | &bufuname[j++], opt_shortname, |
357 | de->lcase & CASE_LOWER_BASE); | 358 | de->lcase & CASE_LOWER_BASE); |
@@ -365,13 +366,15 @@ parse_record: | |||
365 | } | 366 | } |
366 | j = last_u; | 367 | j = last_u; |
367 | fat_short2uni(nls_disk, ".", 1, &bufuname[j++]); | 368 | fat_short2uni(nls_disk, ".", 1, &bufuname[j++]); |
368 | for (i = 0; i < 3;) { | 369 | for (i = 8; i < MSDOS_NAME;) { |
369 | if (!de->ext[i]) break; | 370 | if (!work[i]) |
370 | chl = fat_shortname2uni(nls_disk, &de->ext[i], 3 - i, | 371 | break; |
372 | chl = fat_shortname2uni(nls_disk, &work[i], | ||
373 | MSDOS_NAME - i, | ||
371 | &bufuname[j++], opt_shortname, | 374 | &bufuname[j++], opt_shortname, |
372 | de->lcase & CASE_LOWER_EXT); | 375 | de->lcase & CASE_LOWER_EXT); |
373 | if (chl <= 1) { | 376 | if (chl <= 1) { |
374 | if (de->ext[i] != ' ') | 377 | if (work[i] != ' ') |
375 | last_u = j; | 378 | last_u = j; |
376 | } else { | 379 | } else { |
377 | last_u = j; | 380 | last_u = j; |
@@ -445,7 +448,7 @@ static int __fat_readdir(struct inode *inode, struct file *filp, void *dirent, | |||
445 | int fill_len; | 448 | int fill_len; |
446 | wchar_t bufuname[14]; | 449 | wchar_t bufuname[14]; |
447 | wchar_t *unicode = NULL; | 450 | wchar_t *unicode = NULL; |
448 | unsigned char c, work[8], bufname[56], *ptname = bufname; | 451 | unsigned char c, work[MSDOS_NAME], bufname[56], *ptname = bufname; |
449 | unsigned long lpos, dummy, *furrfu = &lpos; | 452 | unsigned long lpos, dummy, *furrfu = &lpos; |
450 | int uni_xlate = sbi->options.unicode_xlate; | 453 | int uni_xlate = sbi->options.unicode_xlate; |
451 | int isvfat = sbi->options.isvfat; | 454 | int isvfat = sbi->options.isvfat; |
@@ -527,7 +530,8 @@ parse_record: | |||
527 | if (work[0] == 0x05) | 530 | if (work[0] == 0x05) |
528 | work[0] = 0xE5; | 531 | work[0] = 0xE5; |
529 | for (i = 0, j = 0, last = 0, last_u = 0; i < 8;) { | 532 | for (i = 0, j = 0, last = 0, last_u = 0; i < 8;) { |
530 | if (!(c = work[i])) break; | 533 | if (!(c = work[i])) |
534 | break; | ||
531 | chl = fat_shortname2uni(nls_disk, &work[i], 8 - i, | 535 | chl = fat_shortname2uni(nls_disk, &work[i], 8 - i, |
532 | &bufuname[j++], opt_shortname, | 536 | &bufuname[j++], opt_shortname, |
533 | de->lcase & CASE_LOWER_BASE); | 537 | de->lcase & CASE_LOWER_BASE); |
@@ -549,9 +553,10 @@ parse_record: | |||
549 | j = last_u; | 553 | j = last_u; |
550 | fat_short2uni(nls_disk, ".", 1, &bufuname[j++]); | 554 | fat_short2uni(nls_disk, ".", 1, &bufuname[j++]); |
551 | ptname[i++] = '.'; | 555 | ptname[i++] = '.'; |
552 | for (i2 = 0; i2 < 3;) { | 556 | for (i2 = 8; i2 < MSDOS_NAME;) { |
553 | if (!(c = de->ext[i2])) break; | 557 | if (!(c = work[i2])) |
554 | chl = fat_shortname2uni(nls_disk, &de->ext[i2], 3 - i2, | 558 | break; |
559 | chl = fat_shortname2uni(nls_disk, &work[i2], MSDOS_NAME - i2, | ||
555 | &bufuname[j++], opt_shortname, | 560 | &bufuname[j++], opt_shortname, |
556 | de->lcase & CASE_LOWER_EXT); | 561 | de->lcase & CASE_LOWER_EXT); |
557 | if (chl <= 1) { | 562 | if (chl <= 1) { |
@@ -563,8 +568,8 @@ parse_record: | |||
563 | } | 568 | } |
564 | } else { | 569 | } else { |
565 | last_u = j; | 570 | last_u = j; |
566 | for (chi = 0; chi < chl && i2 < 3; chi++) { | 571 | for (chi = 0; chi < chl && i2 < MSDOS_NAME; chi++) { |
567 | ptname[i++] = de->ext[i2++]; | 572 | ptname[i++] = work[i2++]; |
568 | last = i; | 573 | last = i; |
569 | } | 574 | } |
570 | } | 575 | } |
diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 479722d89667..cfaf5877d98b 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c | |||
@@ -354,8 +354,7 @@ static int fat_fill_inode(struct inode *inode, struct msdos_dir_entry *de) | |||
354 | } else { /* not a directory */ | 354 | } else { /* not a directory */ |
355 | inode->i_generation |= 1; | 355 | inode->i_generation |= 1; |
356 | inode->i_mode = MSDOS_MKMODE(de->attr, | 356 | inode->i_mode = MSDOS_MKMODE(de->attr, |
357 | ((sbi->options.showexec && | 357 | ((sbi->options.showexec && !is_exec(de->name + 8)) |
358 | !is_exec(de->ext)) | ||
359 | ? S_IRUGO|S_IWUGO : S_IRWXUGO) | 358 | ? S_IRUGO|S_IWUGO : S_IRWXUGO) |
360 | & ~sbi->options.fs_fmask) | S_IFREG; | 359 | & ~sbi->options.fs_fmask) | S_IFREG; |
361 | MSDOS_I(inode)->i_start = le16_to_cpu(de->start); | 360 | MSDOS_I(inode)->i_start = le16_to_cpu(de->start); |