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 */ @@ -57,6 +54,22 @@ void *memccpy(void *dest, const void *src, int c, size_t n) return 0; } +/* + * 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