misc: More static analysis fixes.

This commit is contained in:
Solomon Peachy 2019-05-12 08:17:56 -04:00
parent 1469087f20
commit 473aa2bbc4
6 changed files with 26 additions and 18 deletions

View file

@ -746,8 +746,10 @@ static int canonselphy_read_parse(void *vctx, const void **vjob, int data_fd, in
/* Read the rest of the header.. */
i = read(data_fd, rdbuf + offset, MAX_HEADER - offset);
if (i != MAX_HEADER - offset) {
if (i == 0)
if (i == 0) {
canonselphy_cleanup_job(job);
return CUPS_BACKEND_CANCEL;
}
ERROR("Read failed (%d/%d)\n",
i, MAX_HEADER - offset);
perror("ERROR: Read failed");
@ -767,7 +769,7 @@ static int canonselphy_read_parse(void *vctx, const void **vjob, int data_fd, in
if (printer_type != ctx->type) {
ERROR("Printer/Job mismatch (%d/%d/%d)\n", ctx->type, ctx->printer->type, printer_type);
free(job);
canonselphy_cleanup_job(job);
return CUPS_BACKEND_CANCEL;
}

View file

@ -362,6 +362,7 @@ static int kodak6800_get_mediainfo(struct kodak6800_ctx *ctx)
break;
}
free(media);
return CUPS_BACKEND_OK;
}
@ -1045,16 +1046,16 @@ static int kodak6800_attach(void *vctx, struct libusb_device_handle *dev, int ty
}
uint16_t fw = be16_to_cpu(ctx->sts.main_fw);
if (ctx->type == P_KODAK_6850) {
if ((fw > 800 && fw >= 878) ||
(fw > 600 && fw >= 678)) {
if ((fw >= 878) ||
(fw < 800 && fw >= 678)) {
ctx->supports_sub4x6 = 1;
} else {
WARNING("Printer FW out of date, recommend updating for current media and features\n");
}
} else {
if ((fw > 400 && fw >= 459) ||
(fw > 300 && fw >= 359) ||
(fw > 200 && fw >= 259)) {
if ((fw >= 459) ||
(fw < 400 && fw >= 359) ||
(fw < 300 && fw >= 259)) {
ctx->supports_sub4x6 = 1;
} else {
WARNING("Printer FW out of date, recommend updating for current media and features\n");

View file

@ -2234,14 +2234,14 @@ static void mitsu70x_dump_printerstatus(struct mitsu70x_ctx *ctx,
INFO("iSerial Reporting: %s\n", resp->iserial ? "No" : "Yes" );
INFO("Power Status: %s\n", resp->power ? "Sleeping" : "Awake");
INFO("Available Memory Banks: %s%s%s%s%s%s%s%s\n",
memory & 0x01 ? "mem8 " : "",
memory & 0x02 ? "mem7 " : "",
memory & 0x04 ? "mem6 " : "",
memory & 0x08 ? "mem5 " : "",
memory & 0x10 ? "mem4 " : "",
memory & 0x20 ? "mem3 " : "",
memory & 0x40 ? "mem2 " : "",
memory & 0x80 ? "mem1 " : "");
(memory & 0x01) ? "mem8 " : "",
(memory & 0x02) ? "mem7 " : "",
(memory & 0x04) ? "mem6 " : "",
(memory & 0x08) ? "mem5 " : "",
(memory & 0x10) ? "mem4 " : "",
(memory & 0x20) ? "mem3 " : "",
(memory & 0x40) ? "mem2 " : "",
(memory & 0x80) ? "mem1 " : "");
if (resp->lower.error_status[0]) {
INFO("Lower Error Status: %s/%s -> %s\n",

View file

@ -1549,8 +1549,10 @@ static int shinkos6245_main_loop(void *vctx, const void *vjob) {
ERROR("Failed to execute %s command\n", cmd_names(settime->hdr.cmd));
return CUPS_BACKEND_FAILED;
}
if (resp.result != RESULT_SUCCESS)
goto printer_error;
if (resp.result != RESULT_SUCCESS) {
ERROR("Bad result %02x\n", resp.result);
goto fail;
}
}
// XXX check copies against remaining media!
@ -1688,6 +1690,7 @@ printer_error:
status_str(sts.hdr.status),
sts.hdr.printer_major, sts.hdr.printer_minor,
error_codes(sts.hdr.printer_major, sts.hdr.printer_minor));
fail:
return CUPS_BACKEND_FAILED;
}

View file

@ -198,11 +198,13 @@ static int updneo_read_parse(void *vctx, const void **vjob, int data_fd, int cop
/* Payload length */
tok = strtok(NULL, "\r\n,");
if (!tok) {
updneo_cleanup_job(job);
ERROR("Invalid spool format (block length missing)!\n");
return CUPS_BACKEND_CANCEL;
}
len = atoi(tok);
if (len == 0 || len > MAX_PRINTJOB_LEN) {
updneo_cleanup_job(job);
ERROR("Invalid spool format (block length %d)!\n", len);
return CUPS_BACKEND_CANCEL;
}

View file

@ -130,7 +130,7 @@ if ($proc_count > 1 && $kid > 0) {
$rval = run \@args;
}
if (!$rval) {
print("***** $row[0] $row[1] $row[2] $row[3] $row[4] $copies ***** FAIL: $? \n");
print("***** $row[0] $row[1] $row[2] $row[3] $row[4] $i ***** FAIL: $? \n");
$error++;
}
}