]> git.baikalelectronics.ru Git - kernel.git/commit
cxl/mbox: Use type __u32 for mailbox payload sizes
authorAlison Schofield <alison.schofield@intel.com>
Thu, 14 Apr 2022 05:12:46 +0000 (22:12 -0700)
committerDan Williams <dan.j.williams@intel.com>
Fri, 22 Apr 2022 23:12:04 +0000 (16:12 -0700)
commitab39aa069ba7ba29beae69457cc598f361dce94d
treec33eacd1c947648c140937688fd2c396d231ea96
parent64f3e2b7fe9225b54aeff4ff71e7b1bf93d4533e
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>
drivers/cxl/core/mbox.c
include/uapi/linux/cxl_mem.h