Commit 460a222d authored by James Simmons's avatar James Simmons Committed by Greg Kroah-Hartman

staging: lustre: libcfs: return proper bool values

Return real bool values for libcfs_ioctl_is_invalid().
Signed-off-by: default avatarJames Simmons <uja.ornl@yahoo.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245
Reviewed-on: http://review.whamcloud.com/17643Reviewed-by: default avatarBob Glossman <bob.glossman@intel.com>
Reviewed-by: default avatarJohn L. Hammond <john.hammond@intel.com>
Reviewed-by: default avatarDmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 92c18e13
...@@ -53,56 +53,56 @@ static inline bool libcfs_ioctl_is_invalid(struct libcfs_ioctl_data *data) ...@@ -53,56 +53,56 @@ static inline bool libcfs_ioctl_is_invalid(struct libcfs_ioctl_data *data)
{ {
if (data->ioc_hdr.ioc_len > (1 << 30)) { if (data->ioc_hdr.ioc_len > (1 << 30)) {
CERROR("LIBCFS ioctl: ioc_len larger than 1<<30\n"); CERROR("LIBCFS ioctl: ioc_len larger than 1<<30\n");
return 1; return true;
} }
if (data->ioc_inllen1 > (1<<30)) { if (data->ioc_inllen1 > (1<<30)) {
CERROR("LIBCFS ioctl: ioc_inllen1 larger than 1<<30\n"); CERROR("LIBCFS ioctl: ioc_inllen1 larger than 1<<30\n");
return 1; return true;
} }
if (data->ioc_inllen2 > (1<<30)) { if (data->ioc_inllen2 > (1<<30)) {
CERROR("LIBCFS ioctl: ioc_inllen2 larger than 1<<30\n"); CERROR("LIBCFS ioctl: ioc_inllen2 larger than 1<<30\n");
return 1; return true;
} }
if (data->ioc_inlbuf1 && !data->ioc_inllen1) { if (data->ioc_inlbuf1 && !data->ioc_inllen1) {
CERROR("LIBCFS ioctl: inlbuf1 pointer but 0 length\n"); CERROR("LIBCFS ioctl: inlbuf1 pointer but 0 length\n");
return 1; return true;
} }
if (data->ioc_inlbuf2 && !data->ioc_inllen2) { if (data->ioc_inlbuf2 && !data->ioc_inllen2) {
CERROR("LIBCFS ioctl: inlbuf2 pointer but 0 length\n"); CERROR("LIBCFS ioctl: inlbuf2 pointer but 0 length\n");
return 1; return true;
} }
if (data->ioc_pbuf1 && !data->ioc_plen1) { if (data->ioc_pbuf1 && !data->ioc_plen1) {
CERROR("LIBCFS ioctl: pbuf1 pointer but 0 length\n"); CERROR("LIBCFS ioctl: pbuf1 pointer but 0 length\n");
return 1; return true;
} }
if (data->ioc_pbuf2 && !data->ioc_plen2) { if (data->ioc_pbuf2 && !data->ioc_plen2) {
CERROR("LIBCFS ioctl: pbuf2 pointer but 0 length\n"); CERROR("LIBCFS ioctl: pbuf2 pointer but 0 length\n");
return 1; return true;
} }
if (data->ioc_plen1 && !data->ioc_pbuf1) { if (data->ioc_plen1 && !data->ioc_pbuf1) {
CERROR("LIBCFS ioctl: plen1 nonzero but no pbuf1 pointer\n"); CERROR("LIBCFS ioctl: plen1 nonzero but no pbuf1 pointer\n");
return 1; return true;
} }
if (data->ioc_plen2 && !data->ioc_pbuf2) { if (data->ioc_plen2 && !data->ioc_pbuf2) {
CERROR("LIBCFS ioctl: plen2 nonzero but no pbuf2 pointer\n"); CERROR("LIBCFS ioctl: plen2 nonzero but no pbuf2 pointer\n");
return 1; return true;
} }
if ((__u32)libcfs_ioctl_packlen(data) != data->ioc_hdr.ioc_len) { if ((__u32)libcfs_ioctl_packlen(data) != data->ioc_hdr.ioc_len) {
CERROR("LIBCFS ioctl: packlen != ioc_len\n"); CERROR("LIBCFS ioctl: packlen != ioc_len\n");
return 1; return true;
} }
if (data->ioc_inllen1 && if (data->ioc_inllen1 &&
data->ioc_bulk[data->ioc_inllen1 - 1] != '\0') { data->ioc_bulk[data->ioc_inllen1 - 1] != '\0') {
CERROR("LIBCFS ioctl: inlbuf1 not 0 terminated\n"); CERROR("LIBCFS ioctl: inlbuf1 not 0 terminated\n");
return 1; return true;
} }
if (data->ioc_inllen2 && if (data->ioc_inllen2 &&
data->ioc_bulk[cfs_size_round(data->ioc_inllen1) + data->ioc_bulk[cfs_size_round(data->ioc_inllen1) +
data->ioc_inllen2 - 1] != '\0') { data->ioc_inllen2 - 1] != '\0') {
CERROR("LIBCFS ioctl: inlbuf2 not 0 terminated\n"); CERROR("LIBCFS ioctl: inlbuf2 not 0 terminated\n");
return 1; return true;
} }
return 0; return false;
} }
int libcfs_ioctl_data_adjust(struct libcfs_ioctl_data *data) int libcfs_ioctl_data_adjust(struct libcfs_ioctl_data *data)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment