diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2015-11-11 22:03:42 +0100 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2015-11-13 11:18:27 +0100 |
commit | 3089f5ab15dbab151f18067acbcdf582a90d932d (patch) | |
tree | dcab5a758566ec802bffd83529283d95ec4761b5 /coverity | |
parent | 8d258c7df487d59a524643b71adba602696c5287 (diff) | |
download | lvm2-3089f5ab15dbab151f18067acbcdf582a90d932d.tar.gz |
coverity: model some function
Reduce number of false-positives and model functions in a way
Coverity is able to understand it.
Diffstat (limited to 'coverity')
-rw-r--r-- | coverity/coverity_model.c | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/coverity/coverity_model.c b/coverity/coverity_model.c index 8f54e1fb2..947e9c8f0 100644 --- a/coverity/coverity_model.c +++ b/coverity/coverity_model.c @@ -12,3 +12,97 @@ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +/* + * Coverity usage: + * + * translate model into xml + * cov-make-library -of coverity_model.xml coverity_model.c + * + * compile (using outdir 'cov'): + * cov-build --dir=cov make CC=gcc + * + * analyze (agressively, using 'cov') + * cov-analyze --dir cov --wait-for-license --hfa --concurrency --enable-fnptr --enable-constraint-fpp --security --all --aggressiveness-level=high --field-offset-escape --user-model-file=coverity/coverity_model.xml + * + * generate html output (to 'html' from 'cov'): + * cov-format-errors --dir cov --html-output html + */ + +struct lv_segment; + +struct logical_volume { + struct lv_segment *seg; +}; + +struct lv_segment *first_seg(const struct logical_volume *lv) +{ + return lv->seg; +} + +struct lv_segment *last_seg(const struct logical_volume *lv) +{ + return lv->seg; +} + +/* simple_memccpy() from glibc */ +void *memccpy(void *dest, const void *src, int c, size_t n) +{ + const char *s = src; + char *d = dest; + + while (n-- > 0) + if ((*d++ = *s++) == (char) c) + return d; + + return 0; +} + +/* + * Added extra pointer check to not need these models, + * for now just keep then in file + */ + +/* +struct cmd_context; +struct profile; + +const char *find_config_tree_str(struct cmd_context *cmd, int id, struct profile *profile) +{ + return "text"; +} + +const char *find_config_tree_str_allow_empty(struct cmd_context *cmd, int id, struct profile *profile) +{ + return "text"; +} +*/ + +/* + * Until fixed coverity case# 00531860: + * A FORWARD_NULL false positive on a recursive function call + * + * model also these functions: + */ +/* +const struct dm_config_node; +const struct dm_config_node *find_config_tree_array(struct cmd_context *cmd, int id, struct profile *profile) +{ + const struct dm_config_node *cn; + + return cn; +} + +const struct dm_config_node *find_config_tree_node(struct cmd_context *cmd, int id, struct profile *profile) +{ + const struct dm_config_node *cn; + + return cn; +} + +int find_config_tree_bool(struct cmd_context *cmd, int id, struct profile *profile) +{ + int b; + + return b; +} +*/ |