drivers/raw/skeleton: fix typecasting in skeleton_rawdev_enqueue_bufs()
Checks
Commit Message
In function "skeleton_rawdev_enqueue_bugs", variable "context" is being
typecasted to (int*), and then assigned to a "uint16_t" type variable
"q_id". As the value is a "uint16_t", (int*) is replaced by (uint16_t*).
Signed-off-by: Usman Tanveer <usman.tanveer@emumba.com>
---
drivers/raw/skeleton/skeleton_rawdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Hi Thomas,
Can you please have a look and update the status?
On Wed, Jul 6, 2022 at 11:33 AM Usman Tanveer <usman.tanveer@emumba.com>
wrote:
> In function "skeleton_rawdev_enqueue_bugs", variable "context" is being
> typecasted to (int*), and then assigned to a "uint16_t" type variable
> "q_id". As the value is a "uint16_t", (int*) is replaced by (uint16_t*).
>
> Signed-off-by: Usman Tanveer <usman.tanveer@emumba.com>
> ---
> drivers/raw/skeleton/skeleton_rawdev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/raw/skeleton/skeleton_rawdev.c
> b/drivers/raw/skeleton/skeleton_rawdev.c
> index 16ecae3d92..3f4da88747 100644
> --- a/drivers/raw/skeleton/skeleton_rawdev.c
> +++ b/drivers/raw/skeleton/skeleton_rawdev.c
> @@ -421,7 +421,7 @@ static int skeleton_rawdev_enqueue_bufs(struct
> rte_rawdev *dev,
> * help in complex implementation which require more information
> than
> * just an integer - for example, a queue-pair.
> */
> - q_id = *((int *)context);
> + q_id = *((uint16_t *)context);
>
> for (i = 0; i < count; i++)
> queue_buf[q_id].bufs[i] = buffers[i]->buf_addr;
> --
> 2.25.1
>
>
@@ -421,7 +421,7 @@ static int skeleton_rawdev_enqueue_bufs(struct rte_rawdev *dev,
* help in complex implementation which require more information than
* just an integer - for example, a queue-pair.
*/
- q_id = *((int *)context);
+ q_id = *((uint16_t *)context);
for (i = 0; i < count; i++)
queue_buf[q_id].bufs[i] = buffers[i]->buf_addr;