compressdev: fix size of socket ID in device data struct

Message ID 20220301141502.11209-1-rzidane@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series compressdev: fix size of socket ID in device data struct |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-abi-testing success Testing PASS

Commit Message

Raja Zidane March 1, 2022, 2:15 p.m. UTC
  Socket ID is used and interpreted as integer, one of the possible
values for socket id is -1 (SOCKET_ID_ANY).
here socket_id is defined as unsigned 8 bit integer, so when putting
-1, it is interpreted as 255, which causes allocation errors when
trying to allocate from socket_id (255).

change socket_id from unsigned 8 bit integer to integer.

Fixes: ed7dd94f7f66 ("compressdev: add basic device management")
Cc: fiona.trahe@intel.com
Cc: stable@dpdk.org

Signed-off-by: Raja Zidane <rzidane@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 lib/compressdev/rte_compressdev_internal.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Akhil Goyal March 4, 2022, 10:02 a.m. UTC | #1
> Socket ID is used and interpreted as integer, one of the possible
> values for socket id is -1 (SOCKET_ID_ANY).
> here socket_id is defined as unsigned 8 bit integer, so when putting
> -1, it is interpreted as 255, which causes allocation errors when
> trying to allocate from socket_id (255).
> 
> change socket_id from unsigned 8 bit integer to integer.
> 
> Fixes: ed7dd94f7f66 ("compressdev: add basic device management")
> Cc: fiona.trahe@intel.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Raja Zidane <rzidane@nvidia.com>
> Acked-by: Matan Azrad <matan@nvidia.com>
Applied to dpdk-next-crypto

Thanks.
  

Patch

diff --git a/lib/compressdev/rte_compressdev_internal.h b/lib/compressdev/rte_compressdev_internal.h
index 888c8f5c5c..25d8afbfb9 100644
--- a/lib/compressdev/rte_compressdev_internal.h
+++ b/lib/compressdev/rte_compressdev_internal.h
@@ -98,7 +98,7 @@  struct rte_compressdev {
 struct rte_compressdev_data {
 	uint8_t dev_id;
 	/**< Compress device identifier */
-	uint8_t socket_id;
+	int socket_id;
 	/**< Socket identifier where memory is allocated */
 	char name[RTE_COMPRESSDEV_NAME_MAX_LEN];
 	/**< Unique identifier name */