Skip to contentSkip to conversation

udf: fix signedness issue

PATCH In review Marcin Slusarz 2 participants 4 messages Dec 16, 2007 – Dec 20, 2007 UDF filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 5/6 udf: fix signedness issue

sparse generated:
fs/udf/namei.c:896:15: originally declared here fs/udf/namei.c:1147:41: warning: incorrect type in argument 3 (different signedness)
fs/udf/namei.c:1147:41: expected int *offset
fs/udf/namei.c:1147:41: got unsigned int *<noident>
fs/udf/namei.c:1152:78: warning: incorrect type in argument 3 (different signedness)
fs/udf/namei.c:1152:78: expected int *offset
fs/udf/namei.c:1152:78: got unsigned int *<noident>

---
 fs/udf/namei.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/udf/namei.c +1 -1
index bec96a6..066153f 100644
@@ -1131,7 +1131,7 @@ static int udf_rename(struct inode *old_dir, struct dentry *old_dentry,
 		}
 	}
 	if (S_ISDIR(old_inode->i_mode)) {
-		uint32_t offset = udf_ext0_offset(old_inode);
+		int offset = udf_ext0_offset(old_inode);
 
 		if (new_inode) {
 			retval = -ENOTEMPTY;

--
1.5.3.4

#1 lore raw
Quoted 10 lines

sparse generated:
fs/udf/namei.c:896:15: originally declared here fs/udf/namei.c:1147:41: warning: incorrect type in argument 3 (different signedness)
fs/udf/namei.c:1147:41: expected int *offset
fs/udf/namei.c:1147:41: got unsigned int *<noident>
fs/udf/namei.c:1152:78: warning: incorrect type in argument 3 (different signedness)
fs/udf/namei.c:1152:78: expected int *offset
fs/udf/namei.c:1152:78: got unsigned int *<noident>

I don't think this is right. udf_get_fileident() should take "unsigned
int *" as an offset, not just "int". This means changing struct udf_fileident_bh to use unsigned int too but that is better anyway.
And BTW the type shouldn't be uint32_t but really unsigned int in
udf_rename (int needn't have 32 bits on all archs (although I think it has currently)).

Honza

Quoted 25 lines
---
 fs/udf/namei.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/udf/namei.c +1 -2
index bec96a6..066153f 100644
@@ -1131,7 +1131,7 @@ static int udf_rename(struct inode *old_dir, struct dentry *old_dentry,
 		}
 	}
 	if (S_ISDIR(old_inode->i_mode)) {
-		uint32_t offset = udf_ext0_offset(old_inode);
+		int offset = udf_ext0_offset(old_inode);
 
 		if (new_inode) {
 			retval = -ENOTEMPTY;
--

1.5.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 2 lines
Jan Kara <[email protected]>
SuSE CR Labs
#2 lore raw
Quoted 9 lines · Jan Kara
Quoted 9 lines

sparse generated:
fs/udf/namei.c:896:15: originally declared here fs/udf/namei.c:1147:41: warning: incorrect type in argument 3 (different signedness)
fs/udf/namei.c:1147:41: expected int *offset
fs/udf/namei.c:1147:41: got unsigned int *<noident>
fs/udf/namei.c:1152:78: warning: incorrect type in argument 3 (different signedness)
fs/udf/namei.c:1152:78: expected int *offset
fs/udf/namei.c:1152:78: got unsigned int *<noident>

Quoted 7 lines
Quoted 1 line

I don't think this is right. udf_get_fileident() should take "unsigned
int *" as an offset, not just "int". This means changing struct udf_fileident_bh to use unsigned int too but that is better anyway.
And BTW the type shouldn't be uint32_t but really unsigned int in
udf_rename (int needn't have 32 bits on all archs (although I think it has currently)).

That would be hard. Look what is happening with soffset and eoffset eg in udf_fileident_read() - these fields are used as signed ints.

Marcin

Acked-by Acked-by
#3 lore raw
Quoted 11 lines · Marcin Slusarz
Quoted 10 lines · Jan Kara
Quoted 10 lines

sparse generated:
fs/udf/namei.c:896:15: originally declared here fs/udf/namei.c:1147:41: warning: incorrect type in argument 3 (different signedness)
fs/udf/namei.c:1147:41: expected int *offset
fs/udf/namei.c:1147:41: got unsigned int *<noident>
fs/udf/namei.c:1152:78: warning: incorrect type in argument 3 (different signedness)
fs/udf/namei.c:1152:78: expected int *offset
fs/udf/namei.c:1152:78: got unsigned int *<noident>

Quoted 8 lines
Quoted 6 lines

I don't think this is right. udf_get_fileident() should take "unsigned
int *" as an offset, not just "int". This means changing struct udf_fileident_bh to use unsigned int too but that is better anyway.
And BTW the type shouldn't be uint32_t but really unsigned int in
udf_rename (int needn't have 32 bits on all archs (although I think it has currently)).

That would be hard. Look what is happening with soffset and eoffset eg in udf_fileident_read() - these fields are used as signed ints.

Doh, you're right. soffset can go below 0. OK, then your patch is fine.
You can add there

BTW: If you haven't got an email from Andrew about accepting the patches
we agreed upon, then please resend the patches to him (with additional

Thanks.

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR