Skip to contentSkip to conversation

trivial fs/select.c compiler warning fix

PATCH In review Horst Schirmeier 1 participant 2 messages Apr 8, 2006 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 trivial fs/select.c compiler warning fix

This trivial patch fixes
fs/select.c: In function `core_sys_select':
fs/select.c:339: warning: assignment from incompatible pointer type fs/select.c:376: warning: comparison of distinct pointer types lacks a cast by casting to (char *) when accessing stack_fds.

---

fs/select.c +2 -2
index 071660f..3025cec 100644
@@ -336,7 +336,7 @@ static int core_sys_select(int n, fd_set
 	ret = -ENOMEM;
 	size = FDS_BYTES(n);
 	if (6*size < SELECT_STACK_ALLOC)
-		bits = stack_fds;
+		bits = (char *) stack_fds;
 	else
 		bits = kmalloc(6 * size, GFP_KERNEL);
 	if (!bits)
@@ -373,7 +373,7 @@ static int core_sys_select(int n, fd_set
 		ret = -EFAULT;
 
 out:
-	if (bits != stack_fds)
+	if (bits != (char *) stack_fds)
 		kfree(bits);
 out_nofds:
 	return ret;
Signature · 1 line
PGP-Key 0xD40E0E7A
#1 lore raw

Whoops. Looks like Russell King already created a more elaborate patch for this problem yesterday ([email protected]).

Quoted 33 lines · Horst Schirmeier

This trivial patch fixes
fs/select.c: In function `core_sys_select':
fs/select.c:339: warning: assignment from incompatible pointer type fs/select.c:376: warning: comparison of distinct pointer types lacks a cast by casting to (char *) when accessing stack_fds.

---

fs/select.c +2 -2
index 071660f..3025cec 100644
@@ -336,7 +336,7 @@ static int core_sys_select(int n, fd_set
 	ret = -ENOMEM;
 	size = FDS_BYTES(n);
 	if (6*size < SELECT_STACK_ALLOC)
-		bits = stack_fds;
+		bits = (char *) stack_fds;
 	else
 		bits = kmalloc(6 * size, GFP_KERNEL);
 	if (!bits)
@@ -373,7 +373,7 @@ static int core_sys_select(int n, fd_set
 		ret = -EFAULT;
 
 out:
-	if (bits != stack_fds)
+	if (bits != (char *) stack_fds)
 		kfree(bits);
 out_nofds:
 	return ret;
Signature · 1 line
PGP-Key 0xD40E0E7A