diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2015-11-13 20:11:52 +0100 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2015-11-16 01:16:11 +0100 |
commit | 5d4f5873a99c3ebe52e671f828580d4cd045e456 (patch) | |
tree | dab39db2a07ac2ac2e4126fd1279f55d9d8e0f65 /coverity | |
parent | 8ebf2b061174daec744f9e361fa7ca28eb19ea2e (diff) | |
download | lvm2-5d4f5873a99c3ebe52e671f828580d4cd045e456.tar.gz |
coverity: model FD_ZERO
Coverity is not able to understand assembly language in
system's header file, so provide model for such macro.
Note: to really see model in-use: #nodef FD_ZERO model_FD_ZERO
need to go to coverity/config/user_nodefs.h
Diffstat (limited to 'coverity')
-rw-r--r-- | coverity/coverity_model.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/coverity/coverity_model.c b/coverity/coverity_model.c index 947e9c8f0..d41c67c61 100644 --- a/coverity/coverity_model.c +++ b/coverity/coverity_model.c @@ -29,19 +29,16 @@ */ struct lv_segment; - -struct logical_volume { - struct lv_segment *seg; -}; +struct logical_volume; struct lv_segment *first_seg(const struct logical_volume *lv) { - return lv->seg; + return ((struct lv_segment **)lv)[0]; } struct lv_segment *last_seg(const struct logical_volume *lv) { - return lv->seg; + return ((struct lv_segment **)lv)[0]; } /* simple_memccpy() from glibc */ @@ -58,6 +55,22 @@ void *memccpy(void *dest, const void *src, int c, size_t n) } /* + * 2 lines bellow needs to be placed in coverity/config/user_nodefs.h + * Not sure about any other way. + * Without them, coverity shows warning since x86 system header files + * are using inline assembly to reset fdset + */ +//#nodef FD_ZERO model_FD_ZERO +//void model_FD_ZERO(void *fdset); + +void model_FD_ZERO(void *fdset) +{ + unsigned i; + for (i = 0; i < 1024 / 8 / sizeof(int); ++i) + ((int*)fdset)[i]; +} + +/* * Added extra pointer check to not need these models, * for now just keep then in file */ |