DragonFlyBSD bugtracker: Issues
https://bugs.dragonflybsd.org/
https://bugs.dragonflybsd.org/favicon.ico?1629395208
2018-02-22T17:19:52Z
DragonFlyBSD bugtracker
Redmine
DragonFlyBSD - Bug #3123 (Closed): crypto/openssh/channels.c:3258: bad if statement ?
https://bugs.dragonflybsd.org/issues/3123
2018-02-22T17:19:52Z
dcb
<p>crypto/openssh/channels.c:3258]: (warning) The expression 'strcmp(listen_addr,"localhost") != 0' is suspicious. It overlaps 'strcmp(listen_addr,"127.0.0.1") == 0'.</p>
<p>Source code is</p>
<pre><code>} else if (strcmp(listen_addr, "localhost") != 0 ||<br /> strcmp(listen_addr, "127.0.0.1") 0 ||<br /> strcmp(listen_addr, "::1") 0) {</code></pre>
<p>maybe better code</p>
<pre><code>} else if (strcmp(listen_addr, "localhost") 0 ||<br /> strcmp(listen_addr, "127.0.0.1") 0 ||<br /> strcmp(listen_addr, "::1") == 0) {</code></pre>
DragonFlyBSD - Bug #3108 (Closed): sys/dev/disk/fd/fd.c:802: suspicious if statement ?
https://bugs.dragonflybsd.org/issues/3108
2017-12-04T16:20:54Z
dcb
<p>dragonfly/sys/dev/disk/fd/fd.c:799] -> [dragonfly/sys/dev/disk/fd/fd.c:802]: (warning) Opposite inner 'if' condition leads to a dead code block.</p>
<p>Source code is</p>
<pre><code>error = isa_dma_acquire(fdc->dmachan);<br /> if (!error) {<br /> isa_dma_init(fdc->dmachan, 128 << 3 /* XXX max secsize */,<br /> M_WAITOK);<br /> if (error) {<br /> isa_dma_release(fdc->dmachan);</code></pre>
DragonFlyBSD - Bug #3103 (Closed): sys/dev/video/bktr/bktr_core.c: 3 * poor error checking ?
https://bugs.dragonflybsd.org/issues/3103
2017-11-15T10:36:11Z
dcb
<p>1.</p>
<p>dragonfly/sys/dev/video/bktr/bktr_core.c:1845]: (style) Checking if unsigned variable 'temp' is less than zero.</p>
<pre><code>temp = tv_channel( bktr, (int)*(unsigned long *)arg );<br /> if ( temp < 0 ) {</code></pre>
<p>but</p>
<pre><code>unsigned int temp, temp1;</code></pre>
<p>and</p>
<p>dragonfly/sys/dev/video/bktr/bktr_tuner.h:int tv_channel( bktr_ptr_t bktr, int channel );</p>
<p>2.</p>
<p>dragonfly/sys/dev/video/bktr/bktr_core.c:1887]: (style) Checking if unsigned variable 'temp' is less than zero.</p>
<p>3.</p>
<p>dragonfly/sys/dev/video/bktr/bktr_core.c:2171]: (style) Checking if unsigned variable 'temp' is less than zero.</p>
<p>Duplicates.</p>
DragonFlyBSD - Bug #3102 (Closed): sys/dev/drm/radeon/radeon_uvd.c:897: possible cut'n'paste issue ?
https://bugs.dragonflybsd.org/issues/3102
2017-11-15T10:23:51Z
dcb
<p>dragonfly/sys/dev/drm/radeon/radeon_uvd.c:897] -> [dragonfly/sys/dev/drm/radeon/radeon_uvd.c:903]: (warning) Identical condition 'vclk_div>pd_max', second condition is always false</p>
<p>Source code is</p>
<pre><code>if (vclk_div > pd_max)<br /> break; /* vco is too big, it has to stop */</code></pre>
<pre><code>/* calc dclk divider with current vco freq <strong>/<br /> dclk_div = radeon_uvd_calc_upll_post_div(vco_freq, dclk,<br /> pd_min, pd_even);<br /> if (vclk_div > pd_max)<br /> break; /</strong> vco is too big, it has to stop */</code></pre>
<p>Maybe the 2nd if would be better if it sanity checked dclk_div, like</p>
<pre><code>if (dclk_div > pd_max)<br /> break; /* vco is too big, it has to stop */</code></pre>
DragonFlyBSD - Bug #3094 (Closed): dragonfly/sys/vm/vm_page.c:1389: bed sequence of if statements ?
https://bugs.dragonflybsd.org/issues/3094
2017-10-24T11:12:20Z
dcb
<p>dragonfly/sys/vm/vm_page.c:1389]: (style) Expression is always false because 'else if' condition matches previous condition at line 1384.</p>
<p>Source code is</p>
<pre><code>if (m->valid != VM_PAGE_BITS_ALL ||<br /> (m->flags & PG_FICTITIOUS)) {<br /> m = NULL;<br /> } else if (vm_page_sbusy_try(m)) {<br /> m = NULL;<br /> } else if (m->valid != VM_PAGE_BITS_ALL ||<br /> (m->flags & PG_FICTITIOUS)) {<br /> vm_page_sbusy_drop(m);<br /> m = NULL;</code></pre>
DragonFlyBSD - Bug #3083 (Closed): crypto/openssh/auth2-pubkey.c:186]: (style) Suspicious condition
https://bugs.dragonflybsd.org/issues/3083
2017-10-17T16:36:25Z
dcb
<p>crypto/openssh/auth2-pubkey.c:186]: (style) Suspicious condition (assignment + comparison); Clarify expression with parentheses.</p>
<p>Source code is</p>
<pre><code>if ((r = sshbuf_put_cstring(b, "publickey")) != 0 ||<br /> (r = sshbuf_put_u8(b, have_sig)) != 0 ||<br /> (r = sshbuf_put_cstring(b, pkalg) != 0))</code></pre>
<p>Maybe better code</p>
<pre><code>if ((r = sshbuf_put_cstring(b, "publickey")) != 0 ||<br /> (r = sshbuf_put_u8(b, have_sig)) != 0 ||<br /> (r = sshbuf_put_cstring(b, pkalg)) != 0)</code></pre>
DragonFlyBSD - Bug #3077 (Closed): sys/dev/sound/pci/hda/hdaa.c:3081: dead code ?
https://bugs.dragonflybsd.org/issues/3077
2017-10-11T09:02:38Z
dcb
<p>dragonfly/sys/dev/sound/pci/hda/hdaa.c:3080] -> [dragonfly/sys/dev/sound/pci/hda/hdaa.c:3081]: (warning) Opposite inner 'if' condition leads to a dead code block.</p>
<p>Source code is</p>
<pre><code>for (i = devinfo->startnode; cnt < max && i < devinfo->endnode; i++) {<br /> if (cnt >= max) {<br /> device_printf(devinfo->dev, "%s: Ctl overflow!\n",<br /> <i>func</i>);<br /> break;<br /> }</code></pre>
<p>Suggest remove dead code</p>
DragonFlyBSD - Bug #3075 (Closed): sys/bus/u4b/wlan/if_upgt.c: 3 * pointless tests ?
https://bugs.dragonflybsd.org/issues/3075
2017-10-11T08:47:09Z
dcb
<p>dragonfly/sys/bus/u4b/wlan/if_upgt.c:1225]: (style) Unsigned variable 'channel' can't be negative so it is unnecessary to test it.</p>
<p>Source code is</p>
<pre><code>if (!(channel >= 0 && channel < IEEE80211_CHAN_MAX))</code></pre>
<p>but</p>
<pre><code>unsigned channel;</code></pre>
<p>Some duplicates:</p>
<p>dragonfly/sys/bus/u4b/wlan/if_upgt.c:1258]: (style) Unsigned variable 'channel' can't be negative so it is unnecessary to test it.<br />dragonfly/sys/bus/u4b/wlan/if_upgt.c:1286]: (style) Unsigned variable 'channel' can't be negative so it is unnecessary to test it.</p>
DragonFlyBSD - Bug #3074 (Closed): crypto/libressl/crypto/asn1/tasn_enc.c:650]: (warning) Possibl...
https://bugs.dragonflybsd.org/issues/3074
2017-10-11T08:34:29Z
dcb
<p>Source code is</p>
<pre><code>if (cout && len)<br /> memcpy(cout, cont, len);</code></pre>
<p>Some paths through the code have cout == NULL. Suggest new code</p>
<pre><code>if (cout && cont && len)<br /> memcpy(cout, cont, len);</code></pre>
DragonFlyBSD - Bug #3073 (Closed): crypto/libressl/crypto/asn1/a_print.c:81: duplicate condition ?
https://bugs.dragonflybsd.org/issues/3073
2017-10-11T08:31:13Z
dcb
<p>dragonfly/crypto/libressl/crypto/asn1/a_print.c:81] -> [dragonfly/crypto/libressl/crypto/asn1/a_print.c:79]: (style) Same expression on both sides of '||'.</p>
<p>Source code is</p>
<table>
<tr>
<td></td>
<td><br /> ((c >= '0') && (c <= '9')) </td>
<td></td>
<td><br /> (c ' ') </td>
<td></td>
<td> (c '\'') </td>
<td></td>
</tr>
</table>
DragonFlyBSD - Bug #3072 (Closed): dragonfly/crypto/libressl/apps/openssl/speed.c:2067: duplicate...
https://bugs.dragonflybsd.org/issues/3072
2017-10-11T08:28:42Z
dcb
<p>dragonfly/crypto/libressl/apps/openssl/speed.c:2067]: (style) Expression is always false because 'else if' condition matches previous condition at line 2047.</p>
<pre><code>} else if (!strncmp(buf, "+F2:", 4)) {</code></pre>
<pre><code>} else if (!strncmp(buf, "+F2:", 4)) {</code></pre>
DragonFlyBSD - Bug #3017 (Closed): sbin/ipfw3/ipfw3.c:2519: redundant compare ?
https://bugs.dragonflybsd.org/issues/3017
2017-04-11T18:22:44Z
dcb
<p>dragonfly/sbin/ipfw3/ipfw3.c:2519] -> [dragonfly/sbin/ipfw3/ipfw3.c:2519]: (style) Same expression on both sides of '||'.</p>
<pre><code>if (!strncmp(*av, "show", strlen(*av)) ||<br /> !strncmp(*av, "show", strlen(*av))) {</code></pre>
DragonFlyBSD - Bug #3016 (Closed): sbin/hammer2/cmd_snapshot.c:113]: (error) Memory leak: xname
https://bugs.dragonflybsd.org/issues/3016
2017-04-11T18:20:03Z
dcb
<pre>
$ fgrep xname dragonfly/sbin/hammer2/cmd_snapshot.c
char *xname;
xname = strdup("");
asprintf(&xname, ".%s", strrchr(path, '/') + 1);
asprintf(&xname, ".%s", path);
xname = strdup("");
xname,
$
</pre><br />I don't see anywhere that xname is freed. Maybe this would be a good idea ?
DragonFlyBSD - Bug #3015 (Resolved): sbin/gpt/show.c:133: do we always find what we are looking f...
https://bugs.dragonflybsd.org/issues/3015
2017-04-11T18:11:20Z
dcb
<p>dragonfly/sbin/gpt/show.c:133]: (error) Array 'mbr.mbr_part<sup><a href="#fn4">4</a></sup>' accessed at index 4, which is out of bounds.</p>
<p>Source code is</p>
<pre><code>for (i = 0; i < 4; i++) {<br /> start = le16toh(mbr->mbr_part[i].part_start_hi);<br /> start = (start << 16) +<br /> le16toh(mbr->mbr_part[i].part_start_lo);<br /> if (m->map_start == p->map_start + start)<br /> break;<br /> }<br /> printf("%d", mbr->mbr_part[i].part_typ);</code></pre>
<p>In the final printf, the code assumes we have found what we are looking for.</p>
<p>Maybe the code would be stronger if it dealt with the case where it didn't.</p>
DragonFlyBSD - Bug #3011 (In Progress): dragonfly/sys/dev/netif/re/re.c: suspicious code ?
https://bugs.dragonflybsd.org/issues/3011
2017-04-04T08:19:19Z
dcb
<p>dragonfly/sys/dev/netif/re/re.c:6567] -> [dragonfly/sys/dev/netif/re/re.c:6567]: (style) Same expression on both sides of '||'.<br />[dragonfly/sys/dev/netif/re/re.c:21948] -> [dragonfly/sys/dev/netif/re/re.c:21948]: (style) Same expression on both sides of '||'.<br />[dragonfly/sys/dev/netif/re/re.c:21949] -> [dragonfly/sys/dev/netif/re/re.c:21949]: (style) Same expression on both sides of '||'.<br />[dragonfly/sys/dev/netif/re/re.c:22044] -> [dragonfly/sys/dev/netif/re/re.c:22044]: (style) Same expression on both sides of '||'.<br />[dragonfly/sys/dev/netif/re/re.c:22104] -> [dragonfly/sys/dev/netif/re/re.c:22104]: (style) Same expression on both sides of '||'.</p>
<p>Taking the first one as an example:</p>
<pre><code>if ((sc->re_type MACFG_24) || (sc->re_type MACFG_24) || (sc->re_type == MACFG_26))</code></pre>
<p>MACFG_25 exists. Possible cut'n'paste error ?</p>