[PATCH v1] gpudev: return EINVAL if invalid input pointer for free and unregister
Elena Agostini
eagostini at nvidia.com
Thu Nov 18 17:22:47 CET 2021
> From: Stephen Hemminger <stephen at networkplumber.org>
> Date: Thursday, 18 November 2021 at 17:21
> To: Elena Agostini <eagostini at nvidia.com>
> Cc: dev at dpdk.org <dev at dpdk.org>
> Subject: Re: [PATCH v1] gpudev: return EINVAL if invalid input pointer for free and unregister
> External email: Use caution opening links or attachments>
>
> On Thu, 18 Nov 2021 19:28:02 +0000
> <eagostini at nvidia.com> wrote:>
> > diff --git a/lib/gpudev/gpudev.c b/lib/gpudev/gpudev.c
> > index 2b174d8bd5..97575ed979 100644
> > --- a/lib/gpudev/gpudev.c
> > +++ b/lib/gpudev/gpudev.c
> > @@ -576,6 +576,11 @@ rte_gpu_mem_free(int16_t dev_id, void *ptr)
> > return -rte_errno;
> > }
> >
> > + if (ptr == NULL) {
> > + rte_errno = EINVAL;
> > + return -rte_errno;
> > + }
> > +>
> The convention for free(), and rte_free() is that calling free
> with a NULL pointer is a nop. Why not follow those?>
> This would keep programmers from having to view GPU as a
> special case.
Please look at v2 here https://patches.dpdk.org/project/dpdk/patch/20211118203354.25355-1-eagostini@nvidia.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mails.dpdk.org/archives/dev/attachments/20211118/9cf6d93d/attachment.htm>
More information about the dev
mailing list