1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

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
This commit is contained in:
Zdenek Kabelac 2015-11-13 20:11:52 +01:00
parent 8ebf2b0611
commit 5d4f5873a9

View File

@ -29,19 +29,16 @@
*/ */
struct lv_segment; struct lv_segment;
struct logical_volume;
struct logical_volume {
struct lv_segment *seg;
};
struct lv_segment *first_seg(const struct logical_volume *lv) 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) struct lv_segment *last_seg(const struct logical_volume *lv)
{ {
return lv->seg; return ((struct lv_segment **)lv)[0];
} }
/* simple_memccpy() from glibc */ /* simple_memccpy() from glibc */
@ -57,6 +54,22 @@ void *memccpy(void *dest, const void *src, int c, size_t n)
return 0; 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, * Added extra pointer check to not need these models,
* for now just keep then in file * for now just keep then in file