All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] xfs: don't allow negative error tags
@ 2016-06-24 12:22 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2016-06-24 12:22 UTC (permalink / raw)
  To: Dave Chinner; +Cc: kernel-janitors, xfs

Errors go from zero which means no error to XFS_ERRTAG_MAX (22).  My
static checker complains that xfs_errortag_add() puts an upper bound on
this but not a lower bound.  Let's fix it by making it unsigned.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/fs/xfs/xfs_error.h b/fs/xfs/xfs_error.h
index 4ed3042..2e4f67f 100644
--- a/fs/xfs/xfs_error.h
+++ b/fs/xfs/xfs_error.h
@@ -128,7 +128,7 @@ extern int xfs_error_test(int, int *, char *, int, char *, unsigned long);
 	 xfs_error_test((tag), (mp)->m_fixedfsid, "expr", __LINE__, __FILE__, \
 			(rf))))
 
-extern int xfs_errortag_add(int error_tag, struct xfs_mount *mp);
+extern int xfs_errortag_add(unsigned int error_tag, struct xfs_mount *mp);
 extern int xfs_errortag_clearall(struct xfs_mount *mp, int loud);
 #else
 #define XFS_TEST_ERROR(expr, mp, tag, rf)	(expr)
diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c
index 355619a..ed7ee4e 100644
--- a/fs/xfs/xfs_error.c
+++ b/fs/xfs/xfs_error.c
@@ -55,7 +55,7 @@ xfs_error_test(int error_tag, int *fsidp, char *expression,
 }
 
 int
-xfs_errortag_add(int error_tag, xfs_mount_t *mp)
+xfs_errortag_add(unsigned int error_tag, xfs_mount_t *mp)
 {
 	int i;
 	int len;

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [patch] xfs: don't allow negative error tags
@ 2016-06-24 12:22 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2016-06-24 12:22 UTC (permalink / raw)
  To: Dave Chinner; +Cc: kernel-janitors, xfs

Errors go from zero which means no error to XFS_ERRTAG_MAX (22).  My
static checker complains that xfs_errortag_add() puts an upper bound on
this but not a lower bound.  Let's fix it by making it unsigned.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/fs/xfs/xfs_error.h b/fs/xfs/xfs_error.h
index 4ed3042..2e4f67f 100644
--- a/fs/xfs/xfs_error.h
+++ b/fs/xfs/xfs_error.h
@@ -128,7 +128,7 @@ extern int xfs_error_test(int, int *, char *, int, char *, unsigned long);
 	 xfs_error_test((tag), (mp)->m_fixedfsid, "expr", __LINE__, __FILE__, \
 			(rf))))
 
-extern int xfs_errortag_add(int error_tag, struct xfs_mount *mp);
+extern int xfs_errortag_add(unsigned int error_tag, struct xfs_mount *mp);
 extern int xfs_errortag_clearall(struct xfs_mount *mp, int loud);
 #else
 #define XFS_TEST_ERROR(expr, mp, tag, rf)	(expr)
diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c
index 355619a..ed7ee4e 100644
--- a/fs/xfs/xfs_error.c
+++ b/fs/xfs/xfs_error.c
@@ -55,7 +55,7 @@ xfs_error_test(int error_tag, int *fsidp, char *expression,
 }
 
 int
-xfs_errortag_add(int error_tag, xfs_mount_t *mp)
+xfs_errortag_add(unsigned int error_tag, xfs_mount_t *mp)
 {
 	int i;
 	int len;

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] xfs: don't allow negative error tags
  2016-06-24 12:22 ` Dan Carpenter
  (?)
@ 2016-06-24 13:12 ` Jeff Liu
  2016-06-24 13:27     ` Dan Carpenter
  -1 siblings, 1 reply; 6+ messages in thread
From: Jeff Liu @ 2016-06-24 13:12 UTC (permalink / raw)
  To: kernel-janitors

Hi Dan,

xfs_errortag_add() is called by xfs_file_ioctl(), which accept the 1st
argument as signed, i.e,

typedef struct xfs_error_injection {
__s32 fd;
__s32 errtag;
} xfs_error_injection_t;

Should we make it happy as well? Also, the typedef can be converted to
to struct xfs_error_injection by removing the depreciated
xfs_error_injection_t
syntax if so.

On 2016年06月24日 20:22, Dan Carpenter wrote:

Errors go from zero which means no error to XFS_ERRTAG_MAX (22).  My
static checker complains that xfs_errortag_add() puts an upper bound on
this but not a lower bound.  Let's fix it by making it unsigned.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/fs/xfs/xfs_error.h b/fs/xfs/xfs_error.h
index 4ed3042..2e4f67f 100644
--- a/fs/xfs/xfs_error.h
+++ b/fs/xfs/xfs_error.h
@@ -128,7 +128,7 @@ extern int xfs_error_test(int, int *, char *, int, char *, unsigned long);
 	 xfs_error_test((tag), (mp)->m_fixedfsid, "expr", __LINE__, __FILE__, \
 			(rf))))
 
-extern int xfs_errortag_add(int error_tag, struct xfs_mount *mp);
+extern int xfs_errortag_add(unsigned int error_tag, struct xfs_mount *mp);
 extern int xfs_errortag_clearall(struct xfs_mount *mp, int loud);
 #else
 #define XFS_TEST_ERROR(expr, mp, tag, rf)	(expr)
diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c
index 355619a..ed7ee4e 100644
--- a/fs/xfs/xfs_error.c
+++ b/fs/xfs/xfs_error.c
@@ -55,7 +55,7 @@ xfs_error_test(int error_tag, int *fsidp, char *expression,
 }
 
 int
-xfs_errortag_add(int error_tag, xfs_mount_t *mp)
+xfs_errortag_add(unsigned int error_tag, xfs_mount_t *mp)
 {
 	int i;
 	int len;

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs


-- 
Cheers,

Jeff Liu


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] xfs: don't allow negative error tags
  2016-06-24 12:22 ` Dan Carpenter
  (?)
  (?)
@ 2016-06-24 13:20 ` Jeff Liu
  -1 siblings, 0 replies; 6+ messages in thread
From: Jeff Liu @ 2016-06-24 13:20 UTC (permalink / raw)
  To: kernel-janitors

Hi Dan,

xfs_errortag_add() is called by xfs_file_ioctl(), which accept the 1st
argument as signed, i.e,

typedef struct xfs_error_injection {
__s32 fd;
__s32 errtag;
} xfs_error_injection_t;

Should we make it happy as well? Also, the typedef can be converted to
to struct xfs_error_injection by removing the depreciated
xfs_error_injection_t
syntax if so.

On 2016年06月24日 20:22, Dan Carpenter wrote:

Errors go from zero which means no error to XFS_ERRTAG_MAX (22).  My
static checker complains that xfs_errortag_add() puts an upper bound on
this but not a lower bound.  Let's fix it by making it unsigned.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/fs/xfs/xfs_error.h b/fs/xfs/xfs_error.h
index 4ed3042..2e4f67f 100644
--- a/fs/xfs/xfs_error.h
+++ b/fs/xfs/xfs_error.h
@@ -128,7 +128,7 @@ extern int xfs_error_test(int, int *, char *, int, char *, unsigned long);
 	 xfs_error_test((tag), (mp)->m_fixedfsid, "expr", __LINE__, __FILE__, \
 			(rf))))
 
-extern int xfs_errortag_add(int error_tag, struct xfs_mount *mp);
+extern int xfs_errortag_add(unsigned int error_tag, struct xfs_mount *mp);
 extern int xfs_errortag_clearall(struct xfs_mount *mp, int loud);
 #else
 #define XFS_TEST_ERROR(expr, mp, tag, rf)	(expr)
diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c
index 355619a..ed7ee4e 100644
--- a/fs/xfs/xfs_error.c
+++ b/fs/xfs/xfs_error.c
@@ -55,7 +55,7 @@ xfs_error_test(int error_tag, int *fsidp, char *expression,
 }
 
 int
-xfs_errortag_add(int error_tag, xfs_mount_t *mp)
+xfs_errortag_add(unsigned int error_tag, xfs_mount_t *mp)
 {
 	int i;
 	int len;

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs


-- 
Cheers,

Jeff Liu


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] xfs: don't allow negative error tags
  2016-06-24 13:12 ` Jeff Liu
@ 2016-06-24 13:27     ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2016-06-24 13:27 UTC (permalink / raw)
  To: Jeff Liu; +Cc: kernel-janitors, xfs

On Fri, Jun 24, 2016 at 09:12:25PM +0800, Jeff Liu wrote:
> Hi Dan,
> 
> xfs_errortag_add() is called by xfs_file_ioctl(), which accept the 1st
> argument as signed, i.e,
> 
> typedef struct xfs_error_injection {
> __s32 fd;
> __s32 errtag;
> } xfs_error_injection_t;
> 
> Should we make it happy as well? Also, the typedef can be converted to
> to struct xfs_error_injection by removing the depreciated
> xfs_error_injection_t
> syntax if so.

That has been the user interface for a while so I didn't want to change
it.

regards,
dan carpenter

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] xfs: don't allow negative error tags
@ 2016-06-24 13:27     ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2016-06-24 13:27 UTC (permalink / raw)
  To: Jeff Liu; +Cc: kernel-janitors, xfs

On Fri, Jun 24, 2016 at 09:12:25PM +0800, Jeff Liu wrote:
> Hi Dan,
> 
> xfs_errortag_add() is called by xfs_file_ioctl(), which accept the 1st
> argument as signed, i.e,
> 
> typedef struct xfs_error_injection {
> __s32 fd;
> __s32 errtag;
> } xfs_error_injection_t;
> 
> Should we make it happy as well? Also, the typedef can be converted to
> to struct xfs_error_injection by removing the depreciated
> xfs_error_injection_t
> syntax if so.

That has been the user interface for a while so I didn't want to change
it.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-06-24 13:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-24 12:22 [patch] xfs: don't allow negative error tags Dan Carpenter
2016-06-24 12:22 ` Dan Carpenter
2016-06-24 13:12 ` Jeff Liu
2016-06-24 13:27   ` Dan Carpenter
2016-06-24 13:27     ` Dan Carpenter
2016-06-24 13:20 ` Jeff Liu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.