mirror of
https://github.com/intel/isa-l.git
synced 2025-10-28 11:31:51 +01:00
erasure_code: various fixes for static code analysis issues
Signed-off-by: Tomasz Kantecki <tomasz.kantecki@intel.com>
This commit is contained in:
committed by
Marcel Cornu
parent
ac2ee91cdb
commit
402bd4f773
@@ -142,7 +142,6 @@ int main(int argc, char *argv[])
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
m = k + p;
|
||||
|
||||
if (nerrs > k) {
|
||||
printf
|
||||
@@ -151,6 +150,21 @@ int main(int argc, char *argv[])
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (k <= 0) {
|
||||
printf("Number of source buffers (%d) must be > 0\n", k);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (p <= 0) {
|
||||
printf("Number of parity buffers (%d) must be > 0\n", p);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (nerrs <= 0) {
|
||||
printf("Number of errors (%d) must be > 0\n", nerrs);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (nerrs > p) {
|
||||
printf
|
||||
("Number of errors (%d) cannot be higher than number of parity buffers (%d)\n",
|
||||
@@ -158,13 +172,15 @@ int main(int argc, char *argv[])
|
||||
return -1;
|
||||
}
|
||||
|
||||
m = k + p;
|
||||
|
||||
if (m > MMAX) {
|
||||
printf("Number of total buffers (data and parity) cannot be higher than %d\n",
|
||||
MMAX);
|
||||
return -1;
|
||||
}
|
||||
|
||||
u8 *err_list = malloc(nerrs);
|
||||
u8 *err_list = malloc((size_t)nerrs);
|
||||
if (err_list == NULL) {
|
||||
printf("Error allocating list of array of error indices\n");
|
||||
return -1;
|
||||
@@ -185,7 +201,7 @@ int main(int argc, char *argv[])
|
||||
printf("Testing with %u data buffers and %u parity buffers (num errors = %u, in [ ", k,
|
||||
p, nerrs);
|
||||
for (i = 0; i < nerrs; i++)
|
||||
printf("%d ", err_list[i]);
|
||||
printf("%d ", (int)err_list[i]);
|
||||
|
||||
printf("])\n");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user