aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGravatar Alison Schofield <alison.schofield@intel.com> 2022-04-13 22:12:46 -0700
committerGravatar Dan Williams <dan.j.williams@intel.com> 2022-04-22 16:12:04 -0700
commit26f89535a5bb17915a2e1062c3999a2ee797c7b0 (patch)
treec33eacd1c947648c140937688fd2c396d231ea96 /include
parentPM: CXL: Disable suspend (diff)
downloadlinux-26f89535a5bb17915a2e1062c3999a2ee797c7b0.tar.gz
linux-26f89535a5bb17915a2e1062c3999a2ee797c7b0.tar.bz2
linux-26f89535a5bb17915a2e1062c3999a2ee797c7b0.zip
cxl/mbox: Use type __u32 for mailbox payload sizes
Payload sizes for mailbox commands are expected to be positive values coming from userspace. The documentation correctly describes these as always unsigned values. The mailbox and send structures that support the mailbox commands however, use __s32 types for the payloads. Replace __s32 with __u32 in the mailbox and send command structures and update usages. Kernel users of the interface already block all negative values and there is no known ability for userspace to have grown a dependency on submitting negative values to the kernel. The known user of the IOCTL, the CXL command line interface (cxl-cli) already enforces positive size values. A Smatch warning of a signedness uncovered this issue. Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Alison Schofield <alison.schofield@intel.com> Link: https://lore.kernel.org/r/20220414051246.1244575-1-alison.schofield@intel.com Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'include')
-rw-r--r--include/uapi/linux/cxl_mem.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/include/uapi/linux/cxl_mem.h b/include/uapi/linux/cxl_mem.h
index 8d206f27bb6d..c71021a2a9ed 100644
--- a/include/uapi/linux/cxl_mem.h
+++ b/include/uapi/linux/cxl_mem.h
@@ -68,8 +68,8 @@ static const struct {
* struct cxl_command_info - Command information returned from a query.
* @id: ID number for the command.
* @flags: Flags that specify command behavior.
- * @size_in: Expected input size, or -1 if variable length.
- * @size_out: Expected output size, or -1 if variable length.
+ * @size_in: Expected input size, or ~0 if variable length.
+ * @size_out: Expected output size, or ~0 if variable length.
*
* Represents a single command that is supported by both the driver and the
* hardware. This is returned as part of an array from the query ioctl. The
@@ -78,7 +78,7 @@ static const struct {
*
* - @id = 10
* - @flags = 0
- * - @size_in = -1
+ * - @size_in = ~0
* - @size_out = 0
*
* See struct cxl_mem_query_commands.
@@ -89,8 +89,8 @@ struct cxl_command_info {
__u32 flags;
#define CXL_MEM_COMMAND_FLAG_MASK GENMASK(0, 0)
- __s32 size_in;
- __s32 size_out;
+ __u32 size_in;
+ __u32 size_out;
};
/**
@@ -169,13 +169,13 @@ struct cxl_send_command {
__u32 retval;
struct {
- __s32 size;
+ __u32 size;
__u32 rsvd;
__u64 payload;
} in;
struct {
- __s32 size;
+ __u32 size;
__u32 rsvd;
__u64 payload;
} out;