]> git.baikalelectronics.ru Git - kernel.git/commit
platform/surface: aggregator_cdev: Add comments regarding unchecked allocation size
authorMaximilian Luz <luzmaximilian@gmail.com>
Mon, 11 Jan 2021 15:48:51 +0000 (16:48 +0100)
committerHans de Goede <hdegoede@redhat.com>
Wed, 13 Jan 2021 09:30:21 +0000 (10:30 +0100)
commit0fc7c0e1a567f888967ca6e3a15c53028bbb4873
treee371e98e6b994e33c6e39d798b4f3622243ea058
parent0ac0cffb0eba819832aa62f6683ec9ad8d47d8bd
platform/surface: aggregator_cdev: Add comments regarding unchecked allocation size

CI static analysis complains about the allocation size in payload and
response buffers being unchecked. In general, these allocations should
be safe as the user-input is u16 and thus limited to U16_MAX, which is
only slightly larger than the theoretical maximum imposed by the
underlying SSH protocol.

All bounds on these values required by the underlying protocol are
enforced in ssam_request_sync() (or rather the functions called by it),
thus bounds here are only relevant for allocation.

Add comments explaining that this should be safe.

Reported-by: Colin Ian King <colin.king@canonical.com>
Fixes: 3f35ea58e598 ("platform/surface: Add Surface Aggregator user-space interface")
Addresses-Coverity: ("Untrusted allocation size")
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Link: https://lore.kernel.org/r/20210111154851.325404-3-luzmaximilian@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
drivers/platform/surface/surface_aggregator_cdev.c