diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2010-01-31 17:09:29 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2010-03-03 14:07:57 -0500 |
commit | 7e7742ee005c887b86fd1fd38d5b48419329dfa0 (patch) | |
tree | d3bfe43e360fe53a2c07ce2014f2f4714aa24b4b /fs/hpfs/namei.c | |
parent | 1f707137b55764740981d022d29c622832a61880 (diff) |
sanitize signedness/const for pointers to char in hpfs a bit
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/hpfs/namei.c')
-rw-r--r-- | fs/hpfs/namei.c | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/fs/hpfs/namei.c b/fs/hpfs/namei.c index 82b9c4ba9ed0..15fd2c06f4a7 100644 --- a/fs/hpfs/namei.c +++ b/fs/hpfs/namei.c | |||
@@ -11,7 +11,7 @@ | |||
11 | 11 | ||
12 | static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | 12 | static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) |
13 | { | 13 | { |
14 | const char *name = dentry->d_name.name; | 14 | const unsigned char *name = dentry->d_name.name; |
15 | unsigned len = dentry->d_name.len; | 15 | unsigned len = dentry->d_name.len; |
16 | struct quad_buffer_head qbh0; | 16 | struct quad_buffer_head qbh0; |
17 | struct buffer_head *bh; | 17 | struct buffer_head *bh; |
@@ -24,7 +24,7 @@ static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
24 | int r; | 24 | int r; |
25 | struct hpfs_dirent dee; | 25 | struct hpfs_dirent dee; |
26 | int err; | 26 | int err; |
27 | if ((err = hpfs_chk_name((char *)name, &len))) return err==-ENOENT ? -EINVAL : err; | 27 | if ((err = hpfs_chk_name(name, &len))) return err==-ENOENT ? -EINVAL : err; |
28 | lock_kernel(); | 28 | lock_kernel(); |
29 | err = -ENOSPC; | 29 | err = -ENOSPC; |
30 | fnode = hpfs_alloc_fnode(dir->i_sb, hpfs_i(dir)->i_dno, &fno, &bh); | 30 | fnode = hpfs_alloc_fnode(dir->i_sb, hpfs_i(dir)->i_dno, &fno, &bh); |
@@ -62,7 +62,7 @@ static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
62 | result->i_mode &= ~0222; | 62 | result->i_mode &= ~0222; |
63 | 63 | ||
64 | mutex_lock(&hpfs_i(dir)->i_mutex); | 64 | mutex_lock(&hpfs_i(dir)->i_mutex); |
65 | r = hpfs_add_dirent(dir, (char *)name, len, &dee, 0); | 65 | r = hpfs_add_dirent(dir, name, len, &dee, 0); |
66 | if (r == 1) | 66 | if (r == 1) |
67 | goto bail3; | 67 | goto bail3; |
68 | if (r == -1) { | 68 | if (r == -1) { |
@@ -121,7 +121,7 @@ bail: | |||
121 | 121 | ||
122 | static int hpfs_create(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd) | 122 | static int hpfs_create(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd) |
123 | { | 123 | { |
124 | const char *name = dentry->d_name.name; | 124 | const unsigned char *name = dentry->d_name.name; |
125 | unsigned len = dentry->d_name.len; | 125 | unsigned len = dentry->d_name.len; |
126 | struct inode *result = NULL; | 126 | struct inode *result = NULL; |
127 | struct buffer_head *bh; | 127 | struct buffer_head *bh; |
@@ -130,7 +130,7 @@ static int hpfs_create(struct inode *dir, struct dentry *dentry, int mode, struc | |||
130 | int r; | 130 | int r; |
131 | struct hpfs_dirent dee; | 131 | struct hpfs_dirent dee; |
132 | int err; | 132 | int err; |
133 | if ((err = hpfs_chk_name((char *)name, &len))) | 133 | if ((err = hpfs_chk_name(name, &len))) |
134 | return err==-ENOENT ? -EINVAL : err; | 134 | return err==-ENOENT ? -EINVAL : err; |
135 | lock_kernel(); | 135 | lock_kernel(); |
136 | err = -ENOSPC; | 136 | err = -ENOSPC; |
@@ -155,7 +155,7 @@ static int hpfs_create(struct inode *dir, struct dentry *dentry, int mode, struc | |||
155 | result->i_op = &hpfs_file_iops; | 155 | result->i_op = &hpfs_file_iops; |
156 | result->i_fop = &hpfs_file_ops; | 156 | result->i_fop = &hpfs_file_ops; |
157 | result->i_nlink = 1; | 157 | result->i_nlink = 1; |
158 | hpfs_decide_conv(result, (char *)name, len); | 158 | hpfs_decide_conv(result, name, len); |
159 | hpfs_i(result)->i_parent_dir = dir->i_ino; | 159 | hpfs_i(result)->i_parent_dir = dir->i_ino; |
160 | result->i_ctime.tv_sec = result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, dee.creation_date); | 160 | result->i_ctime.tv_sec = result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, dee.creation_date); |
161 | result->i_ctime.tv_nsec = 0; | 161 | result->i_ctime.tv_nsec = 0; |
@@ -170,7 +170,7 @@ static int hpfs_create(struct inode *dir, struct dentry *dentry, int mode, struc | |||
170 | hpfs_i(result)->mmu_private = 0; | 170 | hpfs_i(result)->mmu_private = 0; |
171 | 171 | ||
172 | mutex_lock(&hpfs_i(dir)->i_mutex); | 172 | mutex_lock(&hpfs_i(dir)->i_mutex); |
173 | r = hpfs_add_dirent(dir, (char *)name, len, &dee, 0); | 173 | r = hpfs_add_dirent(dir, name, len, &dee, 0); |
174 | if (r == 1) | 174 | if (r == 1) |
175 | goto bail2; | 175 | goto bail2; |
176 | if (r == -1) { | 176 | if (r == -1) { |
@@ -211,7 +211,7 @@ bail: | |||
211 | 211 | ||
212 | static int hpfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev) | 212 | static int hpfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev) |
213 | { | 213 | { |
214 | const char *name = dentry->d_name.name; | 214 | const unsigned char *name = dentry->d_name.name; |
215 | unsigned len = dentry->d_name.len; | 215 | unsigned len = dentry->d_name.len; |
216 | struct buffer_head *bh; | 216 | struct buffer_head *bh; |
217 | struct fnode *fnode; | 217 | struct fnode *fnode; |
@@ -220,7 +220,7 @@ static int hpfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t | |||
220 | struct hpfs_dirent dee; | 220 | struct hpfs_dirent dee; |
221 | struct inode *result = NULL; | 221 | struct inode *result = NULL; |
222 | int err; | 222 | int err; |
223 | if ((err = hpfs_chk_name((char *)name, &len))) return err==-ENOENT ? -EINVAL : err; | 223 | if ((err = hpfs_chk_name(name, &len))) return err==-ENOENT ? -EINVAL : err; |
224 | if (hpfs_sb(dir->i_sb)->sb_eas < 2) return -EPERM; | 224 | if (hpfs_sb(dir->i_sb)->sb_eas < 2) return -EPERM; |
225 | if (!new_valid_dev(rdev)) | 225 | if (!new_valid_dev(rdev)) |
226 | return -EINVAL; | 226 | return -EINVAL; |
@@ -256,7 +256,7 @@ static int hpfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t | |||
256 | init_special_inode(result, mode, rdev); | 256 | init_special_inode(result, mode, rdev); |
257 | 257 | ||
258 | mutex_lock(&hpfs_i(dir)->i_mutex); | 258 | mutex_lock(&hpfs_i(dir)->i_mutex); |
259 | r = hpfs_add_dirent(dir, (char *)name, len, &dee, 0); | 259 | r = hpfs_add_dirent(dir, name, len, &dee, 0); |
260 | if (r == 1) | 260 | if (r == 1) |
261 | goto bail2; | 261 | goto bail2; |
262 | if (r == -1) { | 262 | if (r == -1) { |
@@ -289,7 +289,7 @@ bail: | |||
289 | 289 | ||
290 | static int hpfs_symlink(struct inode *dir, struct dentry *dentry, const char *symlink) | 290 | static int hpfs_symlink(struct inode *dir, struct dentry *dentry, const char *symlink) |
291 | { | 291 | { |
292 | const char *name = dentry->d_name.name; | 292 | const unsigned char *name = dentry->d_name.name; |
293 | unsigned len = dentry->d_name.len; | 293 | unsigned len = dentry->d_name.len; |
294 | struct buffer_head *bh; | 294 | struct buffer_head *bh; |
295 | struct fnode *fnode; | 295 | struct fnode *fnode; |
@@ -298,7 +298,7 @@ static int hpfs_symlink(struct inode *dir, struct dentry *dentry, const char *sy | |||
298 | struct hpfs_dirent dee; | 298 | struct hpfs_dirent dee; |
299 | struct inode *result; | 299 | struct inode *result; |
300 | int err; | 300 | int err; |
301 | if ((err = hpfs_chk_name((char *)name, &len))) return err==-ENOENT ? -EINVAL : err; | 301 | if ((err = hpfs_chk_name(name, &len))) return err==-ENOENT ? -EINVAL : err; |
302 | lock_kernel(); | 302 | lock_kernel(); |
303 | if (hpfs_sb(dir->i_sb)->sb_eas < 2) { | 303 | if (hpfs_sb(dir->i_sb)->sb_eas < 2) { |
304 | unlock_kernel(); | 304 | unlock_kernel(); |
@@ -335,7 +335,7 @@ static int hpfs_symlink(struct inode *dir, struct dentry *dentry, const char *sy | |||
335 | result->i_data.a_ops = &hpfs_symlink_aops; | 335 | result->i_data.a_ops = &hpfs_symlink_aops; |
336 | 336 | ||
337 | mutex_lock(&hpfs_i(dir)->i_mutex); | 337 | mutex_lock(&hpfs_i(dir)->i_mutex); |
338 | r = hpfs_add_dirent(dir, (char *)name, len, &dee, 0); | 338 | r = hpfs_add_dirent(dir, name, len, &dee, 0); |
339 | if (r == 1) | 339 | if (r == 1) |
340 | goto bail2; | 340 | goto bail2; |
341 | if (r == -1) { | 341 | if (r == -1) { |
@@ -345,7 +345,7 @@ static int hpfs_symlink(struct inode *dir, struct dentry *dentry, const char *sy | |||
345 | fnode->len = len; | 345 | fnode->len = len; |
346 | memcpy(fnode->name, name, len > 15 ? 15 : len); | 346 | memcpy(fnode->name, name, len > 15 ? 15 : len); |
347 | fnode->up = dir->i_ino; | 347 | fnode->up = dir->i_ino; |
348 | hpfs_set_ea(result, fnode, "SYMLINK", (char *)symlink, strlen(symlink)); | 348 | hpfs_set_ea(result, fnode, "SYMLINK", symlink, strlen(symlink)); |
349 | mark_buffer_dirty(bh); | 349 | mark_buffer_dirty(bh); |
350 | brelse(bh); | 350 | brelse(bh); |
351 | 351 | ||
@@ -369,7 +369,7 @@ bail: | |||
369 | 369 | ||
370 | static int hpfs_unlink(struct inode *dir, struct dentry *dentry) | 370 | static int hpfs_unlink(struct inode *dir, struct dentry *dentry) |
371 | { | 371 | { |
372 | const char *name = dentry->d_name.name; | 372 | const unsigned char *name = dentry->d_name.name; |
373 | unsigned len = dentry->d_name.len; | 373 | unsigned len = dentry->d_name.len; |
374 | struct quad_buffer_head qbh; | 374 | struct quad_buffer_head qbh; |
375 | struct hpfs_dirent *de; | 375 | struct hpfs_dirent *de; |
@@ -381,12 +381,12 @@ static int hpfs_unlink(struct inode *dir, struct dentry *dentry) | |||
381 | int err; | 381 | int err; |
382 | 382 | ||
383 | lock_kernel(); | 383 | lock_kernel(); |
384 | hpfs_adjust_length((char *)name, &len); | 384 | hpfs_adjust_length(name, &len); |
385 | again: | 385 | again: |
386 | mutex_lock(&hpfs_i(inode)->i_parent_mutex); | 386 | mutex_lock(&hpfs_i(inode)->i_parent_mutex); |
387 | mutex_lock(&hpfs_i(dir)->i_mutex); | 387 | mutex_lock(&hpfs_i(dir)->i_mutex); |
388 | err = -ENOENT; | 388 | err = -ENOENT; |
389 | de = map_dirent(dir, hpfs_i(dir)->i_dno, (char *)name, len, &dno, &qbh); | 389 | de = map_dirent(dir, hpfs_i(dir)->i_dno, name, len, &dno, &qbh); |
390 | if (!de) | 390 | if (!de) |
391 | goto out; | 391 | goto out; |
392 | 392 | ||
@@ -451,7 +451,7 @@ out: | |||
451 | 451 | ||
452 | static int hpfs_rmdir(struct inode *dir, struct dentry *dentry) | 452 | static int hpfs_rmdir(struct inode *dir, struct dentry *dentry) |
453 | { | 453 | { |
454 | const char *name = dentry->d_name.name; | 454 | const unsigned char *name = dentry->d_name.name; |
455 | unsigned len = dentry->d_name.len; | 455 | unsigned len = dentry->d_name.len; |
456 | struct quad_buffer_head qbh; | 456 | struct quad_buffer_head qbh; |
457 | struct hpfs_dirent *de; | 457 | struct hpfs_dirent *de; |
@@ -462,12 +462,12 @@ static int hpfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
462 | int err; | 462 | int err; |
463 | int r; | 463 | int r; |
464 | 464 | ||
465 | hpfs_adjust_length((char *)name, &len); | 465 | hpfs_adjust_length(name, &len); |
466 | lock_kernel(); | 466 | lock_kernel(); |
467 | mutex_lock(&hpfs_i(inode)->i_parent_mutex); | 467 | mutex_lock(&hpfs_i(inode)->i_parent_mutex); |
468 | mutex_lock(&hpfs_i(dir)->i_mutex); | 468 | mutex_lock(&hpfs_i(dir)->i_mutex); |
469 | err = -ENOENT; | 469 | err = -ENOENT; |
470 | de = map_dirent(dir, hpfs_i(dir)->i_dno, (char *)name, len, &dno, &qbh); | 470 | de = map_dirent(dir, hpfs_i(dir)->i_dno, name, len, &dno, &qbh); |
471 | if (!de) | 471 | if (!de) |
472 | goto out; | 472 | goto out; |
473 | 473 | ||
@@ -546,10 +546,10 @@ const struct address_space_operations hpfs_symlink_aops = { | |||
546 | static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry, | 546 | static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry, |
547 | struct inode *new_dir, struct dentry *new_dentry) | 547 | struct inode *new_dir, struct dentry *new_dentry) |
548 | { | 548 | { |
549 | char *old_name = (char *)old_dentry->d_name.name; | 549 | const unsigned char *old_name = old_dentry->d_name.name; |
550 | int old_len = old_dentry->d_name.len; | 550 | unsigned old_len = old_dentry->d_name.len; |
551 | char *new_name = (char *)new_dentry->d_name.name; | 551 | const unsigned char *new_name = new_dentry->d_name.name; |
552 | int new_len = new_dentry->d_name.len; | 552 | unsigned new_len = new_dentry->d_name.len; |
553 | struct inode *i = old_dentry->d_inode; | 553 | struct inode *i = old_dentry->d_inode; |
554 | struct inode *new_inode = new_dentry->d_inode; | 554 | struct inode *new_inode = new_dentry->d_inode; |
555 | struct quad_buffer_head qbh, qbh1; | 555 | struct quad_buffer_head qbh, qbh1; |
@@ -560,9 +560,9 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
560 | struct buffer_head *bh; | 560 | struct buffer_head *bh; |
561 | struct fnode *fnode; | 561 | struct fnode *fnode; |
562 | int err; | 562 | int err; |
563 | if ((err = hpfs_chk_name((char *)new_name, &new_len))) return err; | 563 | if ((err = hpfs_chk_name(new_name, &new_len))) return err; |
564 | err = 0; | 564 | err = 0; |
565 | hpfs_adjust_length((char *)old_name, &old_len); | 565 | hpfs_adjust_length(old_name, &old_len); |
566 | 566 | ||
567 | lock_kernel(); | 567 | lock_kernel(); |
568 | /* order doesn't matter, due to VFS exclusion */ | 568 | /* order doesn't matter, due to VFS exclusion */ |
@@ -579,7 +579,7 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
579 | goto end1; | 579 | goto end1; |
580 | } | 580 | } |
581 | 581 | ||
582 | if (!(dep = map_dirent(old_dir, hpfs_i(old_dir)->i_dno, (char *)old_name, old_len, &dno, &qbh))) { | 582 | if (!(dep = map_dirent(old_dir, hpfs_i(old_dir)->i_dno, old_name, old_len, &dno, &qbh))) { |
583 | hpfs_error(i->i_sb, "lookup succeeded but map dirent failed"); | 583 | hpfs_error(i->i_sb, "lookup succeeded but map dirent failed"); |
584 | err = -ENOENT; | 584 | err = -ENOENT; |
585 | goto end1; | 585 | goto end1; |
@@ -590,7 +590,7 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
590 | if (new_inode) { | 590 | if (new_inode) { |
591 | int r; | 591 | int r; |
592 | if ((r = hpfs_remove_dirent(old_dir, dno, dep, &qbh, 1)) != 2) { | 592 | if ((r = hpfs_remove_dirent(old_dir, dno, dep, &qbh, 1)) != 2) { |
593 | if ((nde = map_dirent(new_dir, hpfs_i(new_dir)->i_dno, (char *)new_name, new_len, NULL, &qbh1))) { | 593 | if ((nde = map_dirent(new_dir, hpfs_i(new_dir)->i_dno, new_name, new_len, NULL, &qbh1))) { |
594 | clear_nlink(new_inode); | 594 | clear_nlink(new_inode); |
595 | copy_de(nde, &de); | 595 | copy_de(nde, &de); |
596 | memcpy(nde->name, new_name, new_len); | 596 | memcpy(nde->name, new_name, new_len); |
@@ -618,7 +618,7 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
618 | } | 618 | } |
619 | 619 | ||
620 | if (new_dir == old_dir) | 620 | if (new_dir == old_dir) |
621 | if (!(dep = map_dirent(old_dir, hpfs_i(old_dir)->i_dno, (char *)old_name, old_len, &dno, &qbh))) { | 621 | if (!(dep = map_dirent(old_dir, hpfs_i(old_dir)->i_dno, old_name, old_len, &dno, &qbh))) { |
622 | hpfs_unlock_creation(i->i_sb); | 622 | hpfs_unlock_creation(i->i_sb); |
623 | hpfs_error(i->i_sb, "lookup succeeded but map dirent failed at #2"); | 623 | hpfs_error(i->i_sb, "lookup succeeded but map dirent failed at #2"); |
624 | err = -ENOENT; | 624 | err = -ENOENT; |
@@ -648,7 +648,7 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
648 | brelse(bh); | 648 | brelse(bh); |
649 | } | 649 | } |
650 | hpfs_i(i)->i_conv = hpfs_sb(i->i_sb)->sb_conv; | 650 | hpfs_i(i)->i_conv = hpfs_sb(i->i_sb)->sb_conv; |
651 | hpfs_decide_conv(i, (char *)new_name, new_len); | 651 | hpfs_decide_conv(i, new_name, new_len); |
652 | end1: | 652 | end1: |
653 | if (old_dir != new_dir) | 653 | if (old_dir != new_dir) |
654 | mutex_unlock(&hpfs_i(new_dir)->i_mutex); | 654 | mutex_unlock(&hpfs_i(new_dir)->i_mutex); |