summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorasomers <asomers@FreeBSD.org>2017-02-02 19:50:28 +0000
committerasomers <asomers@FreeBSD.org>2017-02-02 19:50:28 +0000
commitcc500d084d5d3d5930ac536c10c970c18bc78b52 (patch)
tree429c29af8a6dc947bb770a66a9a1a14df69ec686 /usr.bin
parenta003314f3c283832a850fda5be7cd36d1391e5b2 (diff)
downloadFreeBSD-src-cc500d084d5d3d5930ac536c10c970c18bc78b52.zip
FreeBSD-src-cc500d084d5d3d5930ac536c10c970c18bc78b52.tar.gz
MFC r311160, r311210, r311288, r311292, r311298, r311340
r311160: misc minor fixes in mpr(4) sys/dev/mpr/mpr_sas.c * Fix a potential null pointer dereference (CID 1305731) * Check for overrun of the ccb_scsiio.cdb_io.cdb_bytes buffer (CID 1211934) sys/dev/mpr/mpr_sas_lsi.c * Nullify a dangling pointer in mprsas_get_sata_identify * Fix a memory leak in mprsas_SSU_to_SATA_devices (CID 1211935) Reported by: Coverity (partially) CID: 1305731 1211934 1211935 Reviewed by: slm MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D8880 r311210: Quell Coverity for diskinfo(8) * CID 1198994: Don't run the speed disk on a disk with no sectors * CID 1011442: Don't call close(2) if open(2) fails * CID 1011161: Use snprintf instead of sprintf * CID 1009825: Check the return value of lseek Reported by: Coverity CID: 1198994 1011442 1011161 1009825 MFC after: 4 weeks Sponsored by: Spectra Logic Corp r311288: Delete dead code in chat(8) It's always been dead, ever since first import in 1994. It's still dead in OpenBSD's version, too. Reported by: Coverity CID: 270586 MFC after: 4 weeks Sponsored by: Spectra Logic Corp r311292: Remove dead code in rpc_parse.c It's been dead ever since it was imported from TI-RPC in 1995. The dead code is still present in Illumos today, but was removed from NetBSD in 2006. Reported by: Coverity CID: 270097 Obtained from: NetBSD MFC after: 4 weeks Sponsored by: Spectra Logic Corp r311298: Remove dead code in dhclient(8) The offending code has been dead ever since the import from OpenBSD in r195805. OpenBSD later deleted that entire function. Reported by: Coverity CID: 500059 MFC after: 4 weeks Sponsored by: Spectra Logic Corp r311340: Misc Coverity fixes for tail(1) CID 1006402: Initialize stack variable CID 271580: Don't leak memory when ENOMEM. Reported by: Coverity CID: 271580 1006402 MFC after: 4 weeks Sponsored by: Spectra Logic Corp
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/chat/chat.c9
-rw-r--r--usr.bin/rpcgen/rpc_parse.c10
-rw-r--r--usr.bin/tail/reverse.c9
3 files changed, 9 insertions, 19 deletions
diff --git a/usr.bin/chat/chat.c b/usr.bin/chat/chat.c
index fa2df10..c82a130 100644
--- a/usr.bin/chat/chat.c
+++ b/usr.bin/chat/chat.c
@@ -1173,7 +1173,7 @@ int
get_string(char *string)
{
char temp[STR_LEN];
- int c, printed = 0;
+ int c;
size_t len, minlen;
char *s = temp, *end = s + STR_LEN;
char *logged = temp;
@@ -1306,13 +1306,6 @@ get_string(char *string)
alarm(0);
- if (verbose && printed) {
- if (alarmed)
- chat_logf(" -- read timed out");
- else
- chat_logf(" -- read failed: %m");
- }
-
exit_code = 3;
alarmed = 0;
return (0);
diff --git a/usr.bin/rpcgen/rpc_parse.c b/usr.bin/rpcgen/rpc_parse.c
index f7f857a..9f88033 100644
--- a/usr.bin/rpcgen/rpc_parse.c
+++ b/usr.bin/rpcgen/rpc_parse.c
@@ -290,7 +290,6 @@ def_union(definition *defp)
declaration dec;
case_list *cases;
case_list **tailp;
- int flag;
defp->def_kind = DEF_UNION;
scan(TOK_IDENT, &tok);
@@ -309,7 +308,6 @@ def_union(definition *defp)
cases->case_name = tok.str;
scan(TOK_COLON, &tok);
/* now peek at next token */
- flag = 0;
if (peekscan(TOK_CASE, &tok)){
do {
scan2(TOK_IDENT, TOK_CHARCONST, &tok);
@@ -322,14 +320,6 @@ def_union(definition *defp)
scan(TOK_COLON, &tok);
} while (peekscan(TOK_CASE, &tok));
}
- else
- if (flag)
- {
-
- *tailp = cases;
- tailp = &cases->next;
- cases = XALLOC(case_list);
- };
get_declaration(&dec, DEF_UNION);
cases->case_decl = dec;
diff --git a/usr.bin/tail/reverse.c b/usr.bin/tail/reverse.c
index 511f88c..8726905 100644
--- a/usr.bin/tail/reverse.c
+++ b/usr.bin/tail/reverse.c
@@ -117,6 +117,7 @@ r_reg(FILE *fp, const char *fn, enum STYLE style, off_t off, struct stat *sbp)
map.start = NULL;
map.mapoff = map.maxoff = size;
map.fd = fileno(fp);
+ map.maplen = 0;
/*
* Last char is special, ignore whether newline or not. Note that
@@ -205,7 +206,13 @@ r_buf(FILE *fp, const char *fn)
(tl->l = malloc(BSZ)) == NULL) {
if (!mark)
err(1, "malloc");
- tl = enomem ? tl->next : mark;
+ if (enomem)
+ tl = tl->next;
+ else {
+ if (tl)
+ free(tl);
+ tl = mark;
+ }
enomem += tl->len;
} else if (mark) {
tl->next = mark;
OpenPOWER on IntegriCloud