diff mbox

[for-4.10] libxl: annotate s to be nonnull in libxl__enum_from_string

Message ID 20171016140410.32007-1-wei.liu2@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wei Liu Oct. 16, 2017, 2:04 p.m. UTC
Hope this can placate coverity.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Julien Grall <julien.grall@arm.com>
---
 tools/libxl/libxl_internal.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ian Jackson Oct. 16, 2017, 2:56 p.m. UTC | #1
Wei Liu writes ("[PATCH for-4.10] libxl: annotate s to be nonnull in libxl__enum_from_string"):
> Hope this can placate coverity.

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

We are very soon going to want "NN2" and maybe "NN_1_2".

Ian.
Andrew Cooper Oct. 16, 2017, 4:55 p.m. UTC | #2
On 16/10/17 15:56, Ian Jackson wrote:
> Wei Liu writes ("[PATCH for-4.10] libxl: annotate s to be nonnull in libxl__enum_from_string"):
>> Hope this can placate coverity.
> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
>
> We are very soon going to want "NN2" and maybe "NN_1_2".

The hypervisor uses

#define __nonnull(...) __attribute__((__nonnull__(__VA_ARGS__)))

I suggest you use the same in libxl to avoid a combinatorial  explosion
of NN variants.

~Andrew
Ian Jackson Oct. 16, 2017, 5:02 p.m. UTC | #3
Andrew Cooper writes ("Re: [Xen-devel] [PATCH for-4.10] libxl: annotate s to be nonnull in libxl__enum_from_string"):
> On 16/10/17 15:56, Ian Jackson wrote:
> > We are very soon going to want "NN2" and maybe "NN_1_2".
> 
> The hypervisor uses
> 
> #define __nonnull(...) __attribute__((__nonnull__(__VA_ARGS__)))
> 
> I suggest you use the same in libxl to avoid a combinatorial  explosion
> of NN variants.

We have NN already so in our code that should be NN(1) etc. I guess.

Ian.
Julien Grall Oct. 20, 2017, 10:05 a.m. UTC | #4
Hi,

On 16/10/17 15:04, Wei Liu wrote:
> Hope this can placate coverity.
> 
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> ---
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Julien Grall <julien.grall@arm.com>

Release-acked-by: Julien Grall <julien.grall@linaro.org>

Cheers,

> ---
>   tools/libxl/libxl_internal.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
> index 45e6df6c82..9fe472efe3 100644
> --- a/tools/libxl/libxl_internal.h
> +++ b/tools/libxl/libxl_internal.h
> @@ -1711,7 +1711,7 @@ _hidden char *libxl__domid_to_name(libxl__gc *gc, uint32_t domid);
>   _hidden char *libxl__cpupoolid_to_name(libxl__gc *gc, uint32_t poolid);
>   
>   _hidden int libxl__enum_from_string(const libxl_enum_string_table *t,
> -                                    const char *s, int *e);
> +                                    const char *s, int *e) __attribute__((nonnull(2)));
>   
>   _hidden yajl_gen_status libxl__yajl_gen_asciiz(yajl_gen hand, const char *str);
>   
>
diff mbox

Patch

diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 45e6df6c82..9fe472efe3 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -1711,7 +1711,7 @@  _hidden char *libxl__domid_to_name(libxl__gc *gc, uint32_t domid);
 _hidden char *libxl__cpupoolid_to_name(libxl__gc *gc, uint32_t poolid);
 
 _hidden int libxl__enum_from_string(const libxl_enum_string_table *t,
-                                    const char *s, int *e);
+                                    const char *s, int *e) __attribute__((nonnull(2)));
 
 _hidden yajl_gen_status libxl__yajl_gen_asciiz(yajl_gen hand, const char *str);