Browse Source

[coverity] Override assumptions about wcrtomb() and hmac_init()

Newer versions of Coverity use built-in models for wcrtomb() and
hmac_init() that are capable of returning errors, and reports defects
due to code failing to check for these errors.  The actual iPXE
implementations are simpler than Coverity's models and can never
return errors, so these defects are false positives.

Fix by overriding Coverity's built-in models for these functions.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 5 years ago
parent
commit
a5c41483d2
1 changed files with 8 additions and 0 deletions
  1. 8
    0
      contrib/coverity/model.c

+ 8
- 0
contrib/coverity/model.c View File

7
 typedef void * userptr_t;
7
 typedef void * userptr_t;
8
 typedef long long time_t;
8
 typedef long long time_t;
9
 struct tm;
9
 struct tm;
10
+typedef unsigned short wchar_t;
11
+typedef void mbstate_t;
12
+struct digest_algorithm;
10
 
13
 
11
 /* Inhibit use of built-in models for functions where Coverity's
14
 /* Inhibit use of built-in models for functions where Coverity's
12
  * assumptions about the modelled function are incorrect for iPXE.
15
  * assumptions about the modelled function are incorrect for iPXE.
19
 }
22
 }
20
 int getchar ( void ) {
23
 int getchar ( void ) {
21
 }
24
 }
25
+size_t wcrtomb ( char *buf, wchar_t wc, mbstate_t *ps ) {
26
+}
27
+void hmac_init ( struct digest_algorithm *digest, void *digest_ctx,
28
+		 void *key, size_t *key_len ) {
29
+}

Loading…
Cancel
Save