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-i386-user



Hi,

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

1400 new defect(s) introduced to NetBSD-i386-user found with Coverity Scan.
2 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 20 of 1400 defect(s)


** CID 1300283:  Incorrect expression  (IDENTICAL_BRANCHES)
/crypto/external/bsd/netpgp/dist/src/lib/reader.c: 2182 in pgp_pk_sesskey_cb()


________________________________________________________________________________________________________
*** CID 1300283:  Incorrect expression  (IDENTICAL_BRANCHES)
/crypto/external/bsd/netpgp/dist/src/lib/reader.c: 2182 in pgp_pk_sesskey_cb()
2176     			return (pgp_cb_ret_t)0;
2177     		}
2178     		from = 0;
2179     		cbinfo->cryptinfo.keydata =
2180     			pgp_getkeybyid(io, cbinfo->cryptinfo.secring,
2181     				content->pk_sesskey.key_id, &from, NULL);
>>>     CID 1300283:  Incorrect expression  (IDENTICAL_BRANCHES)
>>>     The same code is executed when the condition "!cbinfo->cryptinfo.keydata" is true or false, because the code in the if-then branch and after the if statement is identical. Should the if statement be removed?
2182     		if (!cbinfo->cryptinfo.keydata) {
2183     			break;
2184     		}
2185     		break;
2186     
2187     	default:

** CID 1300282:  Incorrect expression  (IDENTICAL_BRANCHES)
/sys/rump/librump/rumpkern/rump_syscalls.c: 1570 in rump___sysimpl_writev()


________________________________________________________________________________________________________
*** CID 1300282:  Incorrect expression  (IDENTICAL_BRANCHES)
/sys/rump/librump/rumpkern/rump_syscalls.c: 1570 in rump___sysimpl_writev()
1564     	SPARG(&callarg, iovp) = iovp;
1565     	SPARG(&callarg, iovcnt) = iovcnt;
1566     
1567     	error = rsys_syscall(SYS_writev, &callarg, sizeof(callarg), retval);
1568     	rsys_seterrno(error);
1569     	if (error == 0) {
>>>     CID 1300282:  Incorrect expression  (IDENTICAL_BRANCHES)
>>>     The same code is executed regardless of whether "0" is true, because the 'then' and 'else' branches are identical. Should one of the branches be modified, or the entire 'if' statement replaced?
1570     		if (sizeof(ssize_t) > sizeof(register_t))
1571     			rv = *(ssize_t *)retval;
1572     		else
1573     			rv = *retval;
1574     	}
1575     	return rv;

** CID 1300281:  Incorrect expression  (IDENTICAL_BRANCHES)
/sys/rump/librump/rumpkern/rump_syscalls.c: 3786 in rump___sysimpl_extattr_get_link()


________________________________________________________________________________________________________
*** CID 1300281:  Incorrect expression  (IDENTICAL_BRANCHES)
/sys/rump/librump/rumpkern/rump_syscalls.c: 3786 in rump___sysimpl_extattr_get_link()
3780     	SPARG(&callarg, data) = data;
3781     	SPARG(&callarg, nbytes) = nbytes;
3782     
3783     	error = rsys_syscall(SYS_extattr_get_link, &callarg, sizeof(callarg), retval);
3784     	rsys_seterrno(error);
3785     	if (error == 0) {
>>>     CID 1300281:  Incorrect expression  (IDENTICAL_BRANCHES)
>>>     The same code is executed regardless of whether "0" is true, because the 'then' and 'else' branches are identical. Should one of the branches be modified, or the entire 'if' statement replaced?
3786     		if (sizeof(ssize_t) > sizeof(register_t))
3787     			rv = *(ssize_t *)retval;
3788     		else
3789     			rv = *retval;
3790     	}
3791     	return rv;

** CID 1300280:  Incorrect expression  (IDENTICAL_BRANCHES)
/external/gpl2/xcvs/dist/src/acl.c: 1466 in make_perms()


________________________________________________________________________________________________________
*** CID 1300280:  Incorrect expression  (IDENTICAL_BRANCHES)
/external/gpl2/xcvs/dist/src/acl.c: 1466 in make_perms()
1460     			else if (fperms[i] == 'r' && perms[0] == '-')
1461     			{
1462     			    fperms_len = 1;
1463     			    fperms = xmalloc (fperms_len);
1464     			    fperms[0] = '\0';
1465     			}
>>>     CID 1300280:  Incorrect expression  (IDENTICAL_BRANCHES)
>>>     The same code is executed regardless of whether "perms[0] == '-'" is true, because the 'then' and 'else' branches are identical. Should one of the branches be modified, or the entire 'if' statement replaced?
1466     			else if (perms[0] == '-')
1467     			{
1468     			    err = 1;
1469     			    *xerrmsg = xstrdup ("user has other permissions,"
1470     						" cannot remove read ('r')"
1471     						" permission");

** CID 1300279:  Incorrect expression  (IDENTICAL_BRANCHES)
/external/bsd/openldap/dist/clients/tools/ldapurl.c: 77 in do_uri_create()


________________________________________________________________________________________________________
*** CID 1300279:  Incorrect expression  (IDENTICAL_BRANCHES)
/external/bsd/openldap/dist/clients/tools/ldapurl.c: 77 in do_uri_create()
71     		if ( strcasecmp( lud->lud_scheme, "ldap" ) == 0 ) {
72     			lud->lud_port = LDAP_PORT;
73     
74     		} else if ( strcasecmp( lud->lud_scheme, "ldaps" ) == 0 ) {
75     			lud->lud_port = LDAPS_PORT;
76     
>>>     CID 1300279:  Incorrect expression  (IDENTICAL_BRANCHES)
>>>     The same code is executed regardless of whether "strcasecmp(lud->lud_scheme, "ldapi") == 0" is true, because the 'then' and 'else' branches are identical. Should one of the branches be modified, or the entire 'if' statement replaced?
77     		} else if ( strcasecmp( lud->lud_scheme, "ldapi" ) == 0 ) {
78     			lud->lud_port = 0;
79     
80     		} else {
81     			/* forgiving... */
82     			lud->lud_port = 0;

** CID 1300278:  Incorrect expression  (IDENTICAL_BRANCHES)
/home/phil/cov/xsrc/external/mit/xf86-video-tdfx/dist/src/tdfx_driver.c: 2141 in allocateMemory()


________________________________________________________________________________________________________
*** CID 1300278:  Incorrect expression  (IDENTICAL_BRANCHES)
/home/phil/cov/xsrc/external/mit/xf86-video-tdfx/dist/src/tdfx_driver.c: 2141 in allocateMemory()
2135           pTDFX->backOffset -= (0x1 << 12);
2136       }
2137       /* Give the cmd fifo at least             */
2138       /* CMDFIFO_PAGES pages, but no more than  */
2139       /* 64. NOTE: Don't go higher than 64, as  */
2140       /* there is suspect code in Glide3 !      */
>>>     CID 1300278:  Incorrect expression  (IDENTICAL_BRANCHES)
>>>     A ternary expression "1 ? 64 : 64" with identical then and else expressions: "64". Should one of the expressions be modified, or the entire ternary expression replaced?
2141       fifoSize = ((64 <= CMDFIFO_PAGES) ? 64 : CMDFIFO_PAGES) << 12;
2142     
2143       /* We give 4096 bytes to the cursor  */
2144       cursorSize = 4096;
2145       pTDFX->cursorOffset = 0;
2146     

** CID 1300276:  Incorrect expression  (IDENTICAL_BRANCHES)
/sys/rump/librump/rumpkern/rump_syscalls.c: 1069 in rump___sysimpl_readlink()


________________________________________________________________________________________________________
*** CID 1300276:  Incorrect expression  (IDENTICAL_BRANCHES)
/sys/rump/librump/rumpkern/rump_syscalls.c: 1069 in rump___sysimpl_readlink()
1063     	SPARG(&callarg, buf) = buf;
1064     	SPARG(&callarg, count) = count;
1065     
1066     	error = rsys_syscall(SYS_readlink, &callarg, sizeof(callarg), retval);
1067     	rsys_seterrno(error);
1068     	if (error == 0) {
>>>     CID 1300276:  Incorrect expression  (IDENTICAL_BRANCHES)
>>>     The same code is executed regardless of whether "0" is true, because the 'then' and 'else' branches are identical. Should one of the branches be modified, or the entire 'if' statement replaced?
1069     		if (sizeof(ssize_t) > sizeof(register_t))
1070     			rv = *(ssize_t *)retval;
1071     		else
1072     			rv = *retval;
1073     	}
1074     	return rv;

** CID 1300275:  Incorrect expression  (IDENTICAL_BRANCHES)
/sys/rump/librump/rumpkern/rump_syscalls.c: 2040 in rump___sysimpl_pread()


________________________________________________________________________________________________________
*** CID 1300275:  Incorrect expression  (IDENTICAL_BRANCHES)
/sys/rump/librump/rumpkern/rump_syscalls.c: 2040 in rump___sysimpl_pread()
2034     	SPARG(&callarg, PAD) = 0;
2035     	SPARG(&callarg, offset) = offset;
2036     
2037     	error = rsys_syscall(SYS_pread, &callarg, sizeof(callarg), retval);
2038     	rsys_seterrno(error);
2039     	if (error == 0) {
>>>     CID 1300275:  Incorrect expression  (IDENTICAL_BRANCHES)
>>>     The same code is executed regardless of whether "0" is true, because the 'then' and 'else' branches are identical. Should one of the branches be modified, or the entire 'if' statement replaced?
2040     		if (sizeof(ssize_t) > sizeof(register_t))
2041     			rv = *(ssize_t *)retval;
2042     		else
2043     			rv = *retval;
2044     	}
2045     	return rv;

** CID 1300274:  Incorrect expression  (IDENTICAL_BRANCHES)
/external/gpl2/xcvs/dist/src/acl.c: 740 in cvsacl()


________________________________________________________________________________________________________
*** CID 1300274:  Incorrect expression  (IDENTICAL_BRANCHES)
/external/gpl2/xcvs/dist/src/acl.c: 740 in cvsacl()
734     	}
735         }
736     
737         argc -= optind;
738         argv += optind;
739     
>>>     CID 1300274:  Incorrect expression  (IDENTICAL_BRANCHES)
>>>     A ternary expression "is_racl ? 1 : 1" with identical then and else expressions: "1". Should one of the expressions be modified, or the entire ternary expression replaced?
740         if (argc < (is_racl ? 1 : 1))
741     	usage (is_racl ? racl_usage : acl_usage);
742         if (listacl) {
743     	if (strstr (argv[0], ":"))
744     	    usage (is_racl ? racl_usage : acl_usage);
745         } else {

** CID 1300273:  Incorrect expression  (IDENTICAL_BRANCHES)
/sys/rump/librump/rumpkern/rump_syscalls.c: 3878 in rump___sysimpl_extattr_list_file()


________________________________________________________________________________________________________
*** CID 1300273:  Incorrect expression  (IDENTICAL_BRANCHES)
/sys/rump/librump/rumpkern/rump_syscalls.c: 3878 in rump___sysimpl_extattr_list_file()
3872     	SPARG(&callarg, data) = data;
3873     	SPARG(&callarg, nbytes) = nbytes;
3874     
3875     	error = rsys_syscall(SYS_extattr_list_file, &callarg, sizeof(callarg), retval);
3876     	rsys_seterrno(error);
3877     	if (error == 0) {
>>>     CID 1300273:  Incorrect expression  (IDENTICAL_BRANCHES)
>>>     The same code is executed regardless of whether "0" is true, because the 'then' and 'else' branches are identical. Should one of the branches be modified, or the entire 'if' statement replaced?
3878     		if (sizeof(ssize_t) > sizeof(register_t))
3879     			rv = *(ssize_t *)retval;
3880     		else
3881     			rv = *retval;
3882     	}
3883     	return rv;

** CID 1300272:  Incorrect expression  (IDENTICAL_BRANCHES)
/sys/rump/librump/rumpkern/rump_syscalls.c: 3909 in rump___sysimpl_extattr_list_link()


________________________________________________________________________________________________________
*** CID 1300272:  Incorrect expression  (IDENTICAL_BRANCHES)
/sys/rump/librump/rumpkern/rump_syscalls.c: 3909 in rump___sysimpl_extattr_list_link()
3903     	SPARG(&callarg, data) = data;
3904     	SPARG(&callarg, nbytes) = nbytes;
3905     
3906     	error = rsys_syscall(SYS_extattr_list_link, &callarg, sizeof(callarg), retval);
3907     	rsys_seterrno(error);
3908     	if (error == 0) {
>>>     CID 1300272:  Incorrect expression  (IDENTICAL_BRANCHES)
>>>     The same code is executed regardless of whether "0" is true, because the 'then' and 'else' branches are identical. Should one of the branches be modified, or the entire 'if' statement replaced?
3909     		if (sizeof(ssize_t) > sizeof(register_t))
3910     			rv = *(ssize_t *)retval;
3911     		else
3912     			rv = *retval;
3913     	}
3914     	return rv;

** CID 1300271:  Incorrect expression  (IDENTICAL_BRANCHES)
/sys/rump/librump/rumpkern/rump_syscalls.c: 83 in rump___sysimpl_read()


________________________________________________________________________________________________________
*** CID 1300271:  Incorrect expression  (IDENTICAL_BRANCHES)
/sys/rump/librump/rumpkern/rump_syscalls.c: 83 in rump___sysimpl_read()
77     	SPARG(&callarg, buf) = buf;
78     	SPARG(&callarg, nbyte) = nbyte;
79     
80     	error = rsys_syscall(SYS_read, &callarg, sizeof(callarg), retval);
81     	rsys_seterrno(error);
82     	if (error == 0) {
>>>     CID 1300271:  Incorrect expression  (IDENTICAL_BRANCHES)
>>>     The same code is executed regardless of whether "0" is true, because the 'then' and 'else' branches are identical. Should one of the branches be modified, or the entire 'if' statement replaced?
83     		if (sizeof(ssize_t) > sizeof(register_t))
84     			rv = *(ssize_t *)retval;
85     		else
86     			rv = *retval;
87     	}
88     	return rv;

** CID 1300270:  Incorrect expression  (IDENTICAL_BRANCHES)
/home/phil/cov/xsrc/external/mit/MesaLib7/dist/src/mesa/program/nvfragparse.c: 982 in Parse_VectorSrc()


________________________________________________________________________________________________________
*** CID 1300270:  Incorrect expression  (IDENTICAL_BRANCHES)
/home/phil/cov/xsrc/external/mit/MesaLib7/dist/src/mesa/program/nvfragparse.c: 982 in Parse_VectorSrc()
976        if (Parse_String(parseState, "|")) {
977           srcReg->Abs = GL_TRUE;
978           negateAbs = (sign < 0.0F) ? NEGATE_XYZW : NEGATE_NONE;
979     
980           if (Parse_String(parseState, "-"))
981              negateBase = NEGATE_XYZW;
>>>     CID 1300270:  Incorrect expression  (IDENTICAL_BRANCHES)
>>>     The same code is executed regardless of whether "Parse_String(parseState, "+")" is true, because the 'then' and 'else' branches are identical. Should one of the branches be modified, or the entire 'if' statement replaced?
982           else if (Parse_String(parseState, "+"))
983              negateBase = NEGATE_NONE;
984           else
985              negateBase = NEGATE_NONE;
986        }
987        else {

** CID 1300269:  Incorrect expression  (IDENTICAL_BRANCHES)
/usr.bin/make/suff.c: 799 in Suff_EndTransform()


________________________________________________________________________________________________________
*** CID 1300269:  Incorrect expression  (IDENTICAL_BRANCHES)
/usr.bin/make/suff.c: 799 in Suff_EndTransform()
793     	    SuffRemove(p, t);
794     	}
795         } else if ((gn->type & OP_TRANSFORM) && DEBUG(SUFF)) {
796     	fprintf(debug_file, "transformation %s complete\n", gn->name);
797         }
798     
>>>     CID 1300269:  Incorrect expression  (IDENTICAL_BRANCHES)
>>>     A ternary expression "dummy ? 0 : 0" with identical then and else expressions: "0". Should one of the expressions be modified, or the entire ternary expression replaced?
799         return(dummy ? 0 : 0);
800     }
801     
802     /*-
803      *-----------------------------------------------------------------------
804      * SuffRebuildGraph --

** CID 1300268:  Incorrect expression  (IDENTICAL_BRANCHES)
/sys/rump/librump/rumpkern/rump_syscalls.c: 3847 in rump___sysimpl_extattr_list_fd()


________________________________________________________________________________________________________
*** CID 1300268:  Incorrect expression  (IDENTICAL_BRANCHES)
/sys/rump/librump/rumpkern/rump_syscalls.c: 3847 in rump___sysimpl_extattr_list_fd()
3841     	SPARG(&callarg, data) = data;
3842     	SPARG(&callarg, nbytes) = nbytes;
3843     
3844     	error = rsys_syscall(SYS_extattr_list_fd, &callarg, sizeof(callarg), retval);
3845     	rsys_seterrno(error);
3846     	if (error == 0) {
>>>     CID 1300268:  Incorrect expression  (IDENTICAL_BRANCHES)
>>>     The same code is executed regardless of whether "0" is true, because the 'then' and 'else' branches are identical. Should one of the branches be modified, or the entire 'if' statement replaced?
3847     		if (sizeof(ssize_t) > sizeof(register_t))
3848     			rv = *(ssize_t *)retval;
3849     		else
3850     			rv = *retval;
3851     	}
3852     	return rv;

** CID 1300267:  Incorrect expression  (IDENTICAL_BRANCHES)
/usr.bin/make/parse.c: 1131 in ParseClearPath()


________________________________________________________________________________________________________
*** CID 1300267:  Incorrect expression  (IDENTICAL_BRANCHES)
/usr.bin/make/parse.c: 1131 in ParseClearPath()
1125      *-----------------------------------------------------------------------
1126      */
1127     static int
1128     ParseClearPath(void *path, void *dummy)
1129     {
1130         Dir_ClearPath((Lst) path);
>>>     CID 1300267:  Incorrect expression  (IDENTICAL_BRANCHES)
>>>     A ternary expression "dummy ? 0 : 0" with identical then and else expressions: "0". Should one of the expressions be modified, or the entire ternary expression replaced?
1131         return(dummy ? 0 : 0);
1132     }
1133     
1134     /*-
1135      *---------------------------------------------------------------------
1136      * ParseDoDependency  --

** CID 1300266:  Incorrect expression  (IDENTICAL_BRANCHES)
/sys/rump/librump/rumpkern/rump_syscalls.c: 113 in rump___sysimpl_write()


________________________________________________________________________________________________________
*** CID 1300266:  Incorrect expression  (IDENTICAL_BRANCHES)
/sys/rump/librump/rumpkern/rump_syscalls.c: 113 in rump___sysimpl_write()
107     	SPARG(&callarg, buf) = buf;
108     	SPARG(&callarg, nbyte) = nbyte;
109     
110     	error = rsys_syscall(SYS_write, &callarg, sizeof(callarg), retval);
111     	rsys_seterrno(error);
112     	if (error == 0) {
>>>     CID 1300266:  Incorrect expression  (IDENTICAL_BRANCHES)
>>>     The same code is executed regardless of whether "0" is true, because the 'then' and 'else' branches are identical. Should one of the branches be modified, or the entire 'if' statement replaced?
113     		if (sizeof(ssize_t) > sizeof(register_t))
114     			rv = *(ssize_t *)retval;
115     		else
116     			rv = *retval;
117     	}
118     	return rv;

** CID 1300265:  Incorrect expression  (IDENTICAL_BRANCHES)
/home/phil/cov/xsrc/external/mit/xf86-video-xgi/dist/src/vb_setmode.c: 10103 in XGI_GetVCLK2Ptr()


________________________________________________________________________________________________________
*** CID 1300265:  Incorrect expression  (IDENTICAL_BRANCHES)
/home/phil/cov/xsrc/external/mit/xf86-video-xgi/dist/src/vb_setmode.c: 10103 in XGI_GetVCLK2Ptr()
10097                 }
10098             }
10099         }
10100       }
10101       else /* Jong 10/04/2007; merge code */
10102       {		/* LVDS */
>>>     CID 1300265:  Incorrect expression  (IDENTICAL_BRANCHES)
>>>     The same code is executed regardless of whether "ModeNo <= 19" is true, because the 'then' and 'else' branches are identical. Should one of the branches be modified, or the entire 'if' statement replaced?
10103             if ( ModeNo <= 0x13 )
10104                 VCLKIndex = CRT2Index ;
10105     		else
10106     			VCLKIndex = CRT2Index ;
10107     
10108             if ( pVBInfo->IF_DEF_CH7005 == 1 )

** CID 1300264:  Incorrect expression  (IDENTICAL_BRANCHES)
/home/phil/cov/xsrc/external/mit/xf86-video-sis/dist/src/init301.c: 6981 in SiS_SetGroup2()


________________________________________________________________________________________________________
*** CID 1300264:  Incorrect expression  (IDENTICAL_BRANCHES)
/home/phil/cov/xsrc/external/mit/xf86-video-sis/dist/src/init301.c: 6981 in SiS_SetGroup2()
6975          if(SiS_Pr->SiS_VGAHDE >= 960) {
6976             if(!(modeflag & HalfDCLK)) {
6977     	   tempcl = 32;
6978     	   if(SiS_Pr->SiS_VGAHDE >= 1280) {
6979                   tempch = 20;
6980                   tempbx &= ~0x20;
>>>     CID 1300264:  Incorrect expression  (IDENTICAL_BRANCHES)
>>>     The same code is executed regardless of whether "SiS_Pr->SiS_VGAHDE >= 1024" is true, because the 'then' and 'else' branches are identical. Should one of the branches be modified, or the entire 'if' statement replaced?
6981                } else if(SiS_Pr->SiS_VGAHDE >= 1024) {
6982                   tempch = 25;
6983                } else {
6984     	      tempch = 25; /* OK */
6985     	   }
6986             }

** CID 1300263:  Incorrect expression  (IDENTICAL_BRANCHES)
/home/phil/cov/xsrc/external/mit/xf86-video-i740/dist/src/i740_driver.c: 1111 in I740CalcFIFO()


________________________________________________________________________________________________________
*** CID 1300263:  Incorrect expression  (IDENTICAL_BRANCHES)
/home/phil/cov/xsrc/external/mit/xf86-video-i740/dist/src/i740_driver.c: 1111 in I740CalcFIFO()
1105        * all of the snow and vertical banding, but fine adjustments will
1106        * probably be required for other cards.
1107        */
1108     
1109       switch (pScrn->bitsPerPixel) {
1110       case 8:
>>>     CID 1300263:  Incorrect expression  (IDENTICAL_BRANCHES)
>>>     The same code is executed regardless of whether "pI740->HasSGRAM" is true, because the 'then' and 'else' branches are identical. Should one of the branches be modified, or the entire 'if' statement replaced?
1111         if (pI740->HasSGRAM) {
1112           if      (freq > 200) wm = 0x18120000;
1113           else if (freq > 175) wm = 0x16110000;
1114           else if (freq > 135) wm = 0x120E0000;
1115           else                 wm = 0x100D0000;
1116         } else {


________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, https://scan.coverity.com/projects/1448?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