Coverity-updates archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

New Defects reported by Coverity Scan for NetBSD-amd64-user



Hi,

Please find the latest report on new defect(s) introduced to NetBSD-amd64-user found with Coverity Scan.

12 new defect(s) introduced to NetBSD-amd64-user found with Coverity Scan.
8 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 12 of 12 defect(s)


** CID 1267860:  Missing break in switch  (MISSING_BREAK)
/sys/netinet6/ip6_output.c: 2147 in ip6_getpcbopt()

** CID 1267866:  Missing break in switch  (MISSING_BREAK)
/external/bsd/blacklist/bin/blacklistctl.c: 102 in main()

** CID 1267868:  Resource leak  (RESOURCE_LEAK)
/lib/libc/gen/popen.c: 198 in _popen()

** CID 1267869:  Uninitialized scalar variable  (UNINIT)
/external/bsd/blacklist/bin/conf.c: 214 in getmask()

** CID 1267870:  Uninitialized scalar variable  (UNINIT)
/external/bsd/blacklist/lib/bl.c: 411 in bl_recv()

** CID 1267871:  Uninitialized scalar variable  (UNINIT)
/external/bsd/blacklist/lib/bl.c: 374 in bl_send()

** CID 1267872:  Uninitialized scalar variable  (UNINIT)
/external/bsd/blacklist/bin/conf.c: 88 in getnum()

** CID 1267873:  Uninitialized scalar variable  (UNINIT)
/lib/libutil/efun.c: 164 in estrtoi()

** CID 1267874:  Uninitialized scalar variable  (UNINIT)
/lib/libutil/efun.c: 178 in estrtou()

** CID 1267875:  Uninitialized scalar variable  (UNINIT)
/usr.bin/m4/eval.c: 184 in expand_builtin()

** CID 1267876:  Uninitialized scalar variable  (UNINIT)
/usr.bin/m4/eval.c: 844 in doundiv()

** CID 1267924:  Operands don't affect result  (CONSTANT_EXPRESSION_RESULT)
/external/bsd/libevent/dist/buffer.c: 2914 in evbuffer_add_file()


________________________________________________________________________________________________________
*** CID 1267860:  Missing break in switch  (MISSING_BREAK)
/sys/netinet6/ip6_output.c: 2147 in ip6_getpcbopt()
2141     	case IPV6_PREFER_TEMPADDR:
2142     		if (pktopt)
2143     			optdata = (void *)&pktopt->ip6po_prefer_tempaddr;
2144     		else
2145     			optdata = (void *)&defpreftemp;
2146     		optdatalen = sizeof(int);
>>>     CID 1267860:  Missing break in switch  (MISSING_BREAK)
>>>     The above case falls through to this one.
2147     	default:		/* should not happen */
2148     #ifdef DIAGNOSTIC
2149     		panic("ip6_getpcbopt: unexpected option\n");
2150     #endif
2151     		return (ENOPROTOOPT);
2152     	}

________________________________________________________________________________________________________
*** CID 1267866:  Missing break in switch  (MISSING_BREAK)
/external/bsd/blacklist/bin/blacklistctl.c: 102 in main()
96     			break;
97     		case 'd':
98     			debug++;
99     			break;
100     		case 'n':
101     			noheader = 1;
>>>     CID 1267866:  Missing break in switch  (MISSING_BREAK)
>>>     The above case falls through to this one.
102     		case 'r':
103     			remain = 1;
104     			break;
105     		case 'w':
106     			wide = 1;
107     			break;

________________________________________________________________________________________________________
*** CID 1267868:  Resource leak  (RESOURCE_LEAK)
/lib/libc/gen/popen.c: 198 in _popen()
192     		serrno = errno;
193     		(void)__unlockenv();
194     #ifdef _REENTRANT
195     		(void)rwlock_unlock(&pidlist_lock);
196     #endif
197     		errno = serrno;
>>>     CID 1267868:  Resource leak  (RESOURCE_LEAK)
>>>     Variable "cur" going out of scope leaks the storage it points to.
198     		return NULL;
199     		/* NOTREACHED */
200     	case 0:				/* Child. */
201     		pdes_child(pdes, type);
202     		execl(_PATH_BSHELL, "sh", "-c", cmd, NULL);
203     		_exit(127);

________________________________________________________________________________________________________
*** CID 1267869:  Uninitialized scalar variable  (UNINIT)
/external/bsd/blacklist/bin/conf.c: 214 in getmask()
208     }
209     
210     static int
211     getmask(const char *f, size_t l, bool local __unused, const char **p, int def)
212     {
213     	char *d;
>>>     CID 1267869:  Uninitialized scalar variable  (UNINIT)
>>>     Declaring variable "e" without initializer.
214     	int e;
215     	intmax_t im;
216     	const char *s = *p; 
217     
218     	if ((d = strchr(s, ':')) != NULL) {
219     		*d++ = '\0';

________________________________________________________________________________________________________
*** CID 1267870:  Uninitialized scalar variable  (UNINIT)
/external/bsd/blacklist/lib/bl.c: 411 in bl_recv()
405     	msg.msg_iov = &iov;
406     	msg.msg_iovlen = 1;
407     
408     	msg.msg_control = ua.ctrl;
409     	msg.msg_controllen = sizeof(ua.ctrl) + 100;
410     
>>>     CID 1267870:  Uninitialized scalar variable  (UNINIT)
>>>     Using uninitialized value "msg": field "msg"."msg_flags" is uninitialized when calling "recvmsg(int, struct msghdr *, int)".
411             rlen = recvmsg(b->b_fd, &msg, 0);
412             if (rlen == -1) {
413     		bl_log(b->b_fun, LOG_ERR, "%s: recvmsg failed (%m)", __func__);
414     		return NULL;
415             }
416     

________________________________________________________________________________________________________
*** CID 1267871:  Uninitialized scalar variable  (UNINIT)
/external/bsd/blacklist/lib/bl.c: 374 in bl_send()
368     
369     	tried = 0;
370     again:
371     	if (bl_init(b, false) == -1)
372     		return -1;
373     
>>>     CID 1267871:  Uninitialized scalar variable  (UNINIT)
>>>     Using uninitialized value "msg": field "msg"."msg_flags" is uninitialized when calling "sendmsg(int, struct msghdr const *, int)".
374     	if ((sendmsg(b->b_fd, &msg, 0) == -1) && tried++ < NTRIES) {
375     		bl_reset(b);
376     		goto again;
377     	}
378     	return tried >= NTRIES ? -1 : 0;
379     }

________________________________________________________________________________________________________
*** CID 1267872:  Uninitialized scalar variable  (UNINIT)
/external/bsd/blacklist/bin/conf.c: 88 in getnum()
82     	*p = ep;
83     }
84     
85     static int
86     getnum(const char *f, size_t l, void *r, const char *p)
87     {
>>>     CID 1267872:  Uninitialized scalar variable  (UNINIT)
>>>     Declaring variable "e" without initializer.
88     	int e;
89     	intmax_t im;
90     
91     	im = strtoi(p, NULL, 0, 0, INT_MAX, &e);
92     	if (e == 0) {
93     		*(int *)r = (int)im;

________________________________________________________________________________________________________
*** CID 1267873:  Uninitialized scalar variable  (UNINIT)
/lib/libutil/efun.c: 164 in estrtoi()
158     	return rv;
159     }
160     
161     intmax_t
162     estrtoi(const char * nptr, int base, intmax_t lo, intmax_t hi)
163     {
>>>     CID 1267873:  Uninitialized scalar variable  (UNINIT)
>>>     Declaring variable "e" without initializer.
164     	int e;
165     	intmax_t rv = strtoi(nptr, NULL, base, lo, hi, &e);
166     	if (e != 0) {
167     		errno = e;
168     		(*efunc)(1,
169     		    "Cannot convert string value '%s' with base %d to a number in range [%jd .. %jd]",

________________________________________________________________________________________________________
*** CID 1267874:  Uninitialized scalar variable  (UNINIT)
/lib/libutil/efun.c: 178 in estrtou()
172     	return rv;
173     }
174     
175     uintmax_t
176     estrtou(const char * nptr, int base, uintmax_t lo, uintmax_t hi)
177     {
>>>     CID 1267874:  Uninitialized scalar variable  (UNINIT)
>>>     Declaring variable "e" without initializer.
178     	int e;
179     	uintmax_t rv = strtou(nptr, NULL, base, lo, hi, &e);
180     	if (e != 0) {
181     		errno = e;
182     		(*efunc)(1,
183     		    "Cannot convert string value '%s' with base %d to a number in range [%ju .. %ju]",
184     		    nptr, base, lo, hi);
185     	}
186     	return rv;

________________________________________________________________________________________________________
*** CID 1267875:  Uninitialized scalar variable  (UNINIT)
/usr.bin/m4/eval.c: 184 in expand_builtin()
178     	 * doexpr - evaluate arithmetic
179     	 * expression
180     	 */
181     	{
182     		int base = 10;
183     		int maxdigits = 0;
>>>     CID 1267875:  Uninitialized scalar variable  (UNINIT)
>>>     Declaring variable "e" without initializer.
184     		int e;
185     
186     		if (argc > 3) {
187     			base = strtoi(argv[3], NULL, 0, 2, 36, &e);
188     			if (e) {
189     				m4errx(1, "expr: base %s invalid.", argv[3]);

________________________________________________________________________________________________________
*** CID 1267876:  Uninitialized scalar variable  (UNINIT)
/usr.bin/m4/eval.c: 844 in doundiv()
838     {
839     	int ind;
840     	int n;
841     
842     	if (argc > 2) {
843     		for (ind = 2; ind < argc; ind++) {
>>>     CID 1267876:  Uninitialized scalar variable  (UNINIT)
>>>     Declaring variable "e" without initializer.
844     			int e;
845     			n = strtoi(argv[ind], NULL, 0, 1, INT_MAX, &e);
846     			if (e) {
847     				if (errno == EINVAL && mimic_gnu)
848     					getdivfile(argv[ind]);
849     			} else {

________________________________________________________________________________________________________
*** CID 1267924:  Operands don't affect result  (CONSTANT_EXPRESSION_RESULT)
/external/bsd/libevent/dist/buffer.c: 2914 in evbuffer_add_file()
2908     		}
2909     
2910     		/* we add everything to a temporary buffer, so that we
2911     		 * can abort without side effects if the read fails.
2912     		 */
2913     		while (length) {
>>>     CID 1267924:  Operands don't affect result  (CONSTANT_EXPRESSION_RESULT)
>>>     "length > (9223372036854775807L /* ((__int64_t)2147483647L << 32) | 0xffffffffL */)" is always false regardless of the values of its operands. This occurs as the logical first operand of '?:'.
2914     			ev_ssize_t to_read = length > EV_SSIZE_MAX ? EV_SSIZE_MAX : (ev_ssize_t)length;
2915     			read = evbuffer_readfile(tmp, fd, to_read);
2916     			if (read == -1) {
2917     				evbuffer_free(tmp);
2918     				return (-1);
2919     			}


________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, https://scan.coverity.com/projects/1449?tab=overview

To manage Coverity Scan email notifications for "coverity-updates%netbsd.org@localhost", click https://scan.coverity.com/subscriptions/edit?email=coverity-updates%40netbsd.org&token=487286ca1a9a4f4bd485d16f66b5e782 .



Home | Main Index | Thread Index | Old Index