{"id":274483,"date":"2016-02-17T19:50:03","date_gmt":"2016-02-17T16:50:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=274483"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=274483","title":{"rendered":"PVS-Studio \u043f\u043e\u043a\u043e\u043f\u0430\u043b\u0441\u044f \u0432 \u044f\u0434\u0440\u0435 FreeBSD"},"content":{"rendered":"<p>       <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/559\/511\/580\/559511580dacd6797ab8cb144e60cb88.png\" align=\"left\"\/>\u041e\u043a\u043e\u043b\u043e \u0433\u043e\u0434\u0430 \u043d\u0430\u0437\u0430\u0434 \u043c\u044b \u0441\u043c\u043e\u0433\u043b\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u044f\u0434\u0440\u043e Linux. \u042d\u0442\u043e \u0431\u044b\u043b\u0430 \u043e\u0434\u043d\u0430 \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u0435\u043c\u044b\u0445 \u0441\u0442\u0430\u0442\u0435\u0439 \u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 open-source \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0437\u0430 \u0432\u0441\u0451 \u0432\u0440\u0435\u043c\u044f. \u041f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0438 \u043d\u0430 FreeBSD \u0442\u043e\u0433\u0434\u0430 \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u043b\u0438, \u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c. <br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u041e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435<\/h2>\n<p>  <a href=\"https:\/\/www.freebsd.org\/\">FreeBSD<\/a> \u2014 \u044d\u0442\u043e \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0434\u043b\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432, \u0434\u0435\u0441\u043a\u0442\u043e\u043f\u043e\u0432 \u0438 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u044b\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c. \u0415\u0451 \u043a\u043e\u0434 \u043f\u0440\u043e\u0448\u0451\u043b \u0447\u0435\u0440\u0435\u0437 \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u043c \u0442\u0440\u0438\u0434\u0446\u0430\u0442\u044c \u043b\u0435\u0442 \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044f, \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438. \u041e\u043d\u0430 \u0445\u043e\u0440\u043e\u0448\u043e \u0437\u0430\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u043b\u0430 \u0441\u0435\u0431\u044f \u043a\u0430\u043a \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0438\u043d\u0442\u0440\u0430\u043d\u0435\u0442 \u0438 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442-\u0441\u0435\u0442\u0435\u0439, \u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432. \u041e\u043d\u0430 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0430\u0434\u0451\u0436\u043d\u044b\u0435 \u0441\u0435\u0442\u0435\u0432\u044b\u0435 \u0441\u043b\u0443\u0436\u0431\u044b \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u044c\u044e. <\/p>\n<p>  \u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e FreeBSD \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e <a href=\"https:\/\/scan.coverity.com\/projects\/freebsd\">\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f Coverity<\/a>, \u044f \u043d\u0438\u0447\u0443\u0442\u044c \u043d\u0435 \u0436\u0430\u043b\u0435\u044e, \u0447\u0442\u043e \u043f\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0441 \u044d\u0442\u0438\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c, \u0442.\u043a. \u043d\u0430\u0448\u0451\u043b \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0441\u0442. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0438\u0445 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u043e\u043a\u043e\u043b\u043e 40 \u0448\u0442\u0443\u043a, \u0430 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 (\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043e\u0442\u0447\u0451\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0435\u0449\u0451 \u0434\u043e \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438) \u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b \u0441\u043f\u0438\u0441\u043e\u043a \u0438\u0437 ~1000 \u0441\u0435\u0440\u044c\u0451\u0437\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430.<\/p>\n<p>  \u041d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u0438\u0437 \u0432\u044b\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u043c\u043d\u043e\u0433\u0438\u0435 \u043c\u0435\u0441\u0442\u0430 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u043c\u0438 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438, \u043d\u043e \u043e \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e\u0441\u0442\u0438 \u044f \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043c\u043e\u0433\u0443 \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0442.\u043a. \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0441\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u042f \u0434\u0443\u043c\u0430\u044e, \u044d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u043f\u043e\u0432\u043e\u0434 \u0434\u043b\u044f \u0434\u0438\u0441\u043a\u0443\u0441\u0441\u0438\u0439 \u0438 \u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0441 \u0430\u0432\u0442\u043e\u0440\u0430\u043c\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p>  \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0431\u044b\u043b \u0432\u0437\u044f\u0442 \u0441 <a href=\"https:\/\/github.com\/freebsd\/freebsd\">GitHub<\/a> \u0438\u0437 \u0432\u0435\u0442\u043a\u0438 &#8216;master&#8217;. \u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 ~23000 \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u0434\u0432\u0430 \u0434\u0435\u0441\u044f\u0442\u043a\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u043f\u043e\u0434 \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b, \u043d\u043e \u044f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b \u0442\u043e\u043b\u044c\u043a\u043e \u044f\u0434\u0440\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u043e\u0431\u0440\u0430\u043b \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"cpp\"># make buildkernel KERNCONF=MYKERNEL<\/code><\/pre>\n<h2>\u041a\u0430\u043a \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c<\/h2>\n<p>  \u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u044f\u0434\u0440\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043a\u043e\u0434\u0430 <a href=\"http:\/\/www.viva64.com\/ru\/pvs-studio\/\">PVS-Studio<\/a> \u0432\u0435\u0440\u0441\u0438\u0438 6.01.<\/p>\n<p>  \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b \u0441\u0435\u0431\u0435 PC-BSD \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0443\u0442\u0438\u043b\u0438\u0442\u0443 \u043d\u0430 C++, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u043b\u0430 \u0440\u0430\u0431\u043e\u0447\u0435\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u0432 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u0432 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u044f\u0434\u0440\u0430. \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f <a href=\"http:\/\/www.viva64.com\/ru\/t\/0076\/\">\u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432<\/a> \u0438 \u0438\u0445 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e PVS-Studio. \u0422\u0430\u043a\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043b \u043c\u043d\u0435 \u0431\u044b\u0441\u0442\u0440\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442, \u043d\u0435 \u0438\u0437\u0443\u0447\u0430\u044f \u043d\u0435\u0437\u043d\u0430\u043a\u043e\u043c\u0443\u044e \u043c\u043d\u0435 \u0441\u0431\u043e\u0440\u043e\u0447\u043d\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430. \u0410 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0433\u043b\u0443\u0431\u043e\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u043a\u043e\u0434\u0430 \u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u043c\u0430\u043a\u0440\u043e\u0441\u0430\u0445. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0430\u043a\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432.<\/p>\n<p>  \u042f\u0434\u0440\u043e Linux \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b\u043e\u0441\u044c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c, \u0430 \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 Windows \u0434\u0430\u043d\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 \u0443\u0442\u0438\u043b\u0438\u0442\u0435 <a href=\"http:\/\/www.viva64.com\/ru\/b\/0243\/\">Standalone<\/a>, \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0439 \u0432 \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432 PVS-Studio. \u041d\u043e \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0445\u043e\u0442\u044f\u0442 \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0432 \u0441\u0432\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442, \u043e\u0431\u044b\u0447\u043d\u043e \u043d\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 \u044d\u0442\u0438\u043c. \u041e\u043d\u0438 \u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043a\u0430\u043a\u0438\u043c-\u043d\u0438\u0431\u0443\u0434\u044c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u043c \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438. \u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u0443\u0442\u0438\u043b\u0438\u0442 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0431\u044b\u0441\u0442\u0440\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440, \u0435\u0441\u043b\u0438 \u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0441\u0431\u043e\u0440\u043e\u0447\u043d\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430.<\/p>\n<h2>\u041d\u0435\u043e\u0431\u044b\u0447\u043d\u043e\u0435 \u0432\u0435\u0437\u0435\u043d\u0438\u0435<\/h2>\n<p>  \u041f\u0435\u0440\u0432\u0443\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443 \u044f \u043d\u0430\u0448\u0451\u043b \u0435\u0449\u0451 \u0434\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430, \u0434\u0430\u0436\u0435 \u0434\u043e \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0441\u043e\u0431\u0440\u0430\u043b \u044f\u0434\u0440\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0441\u0431\u043e\u0440\u043a\u0443 \u043f\u0440\u0435\u0440\u0432\u0430\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 \u043b\u0438\u043d\u043a\u043e\u0432\u043a\u0438. \u041f\u0435\u0440\u0435\u0439\u0434\u044f \u043a \u0444\u0430\u0439\u043b\u0443, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c\u0443 \u0432 \u043e\u0448\u0438\u0431\u043a\u0435, \u044f \u0443\u0432\u0438\u0434\u0435\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/29b\/a4c\/62b\/29ba4c62bf7f55b47d7a97202eae7850.png\" \/><\/div>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442. \u0414\u043b\u044f \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0442\u0441\u0442\u0443\u043f\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0438\u043c\u0432\u043e\u043b \u0442\u0430\u0431\u0443\u043b\u044f\u0446\u0438\u0438 \u0438 \u043f\u043e\u0434 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0441\u0434\u0432\u0438\u043d\u0443\u043b\u0438 \u0434\u0432\u0430 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430. \u041d\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u0443\u0441\u043b\u043e\u0432\u0438\u044e \u0438 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0432\u0441\u0435\u0433\u0434\u0430. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0437\u0434\u0435\u0441\u044c \u0437\u0430\u0431\u044b\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0444\u0438\u0433\u0443\u0440\u043d\u044b\u0435 \u0441\u043a\u043e\u0431\u043a\u0438.<\/p>\n<p>  \u041a \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u044b\u043b \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439, \u0447\u0442\u043e \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430, \u043d\u043e \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a. \u041f\u0435\u0440\u0435\u0434 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0430\u0434\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043e\u043d \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f, \u0430 \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043e\u0442\u0447\u0451\u0442\u0430, \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0437\u0443\u0447\u0438\u0442\u044c\/\u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c \u0438 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0438\u0442\u044c \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044e. \u0422\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u0443\u044e \u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0443 \u043f\u0440\u043e\u0434\u0435\u043b\u044b\u0432\u0430\u0435\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430, \u043e\u0442\u0432\u0435\u0447\u0430\u044f \u043d\u0430 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u044b\u0435 \u043f\u0438\u0441\u044c\u043c\u0430. \u041d\u0435 \u0440\u0435\u0434\u043a\u0438 \u0441\u043b\u0443\u0447\u0430\u0438, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043f\u0440\u0438\u0441\u044b\u043b\u0430\u044e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0439, \u043f\u043e \u0438\u0445 \u043c\u043d\u0435\u043d\u0438\u044e, \u0430 \u043d\u0430 \u0434\u0435\u043b\u0435 \u044d\u0442\u043e \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u043e\u0439 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0439 \u043e\u0448\u0438\u0431\u043a\u043e\u0439.<\/p>\n<h2>Capy-poste \u0438 \u043e\u0447\u0435\u043f\u044f\u0442\u043a\u0438<\/h2>\n<p>  \u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 PVS-Studio \u2014 \u043c\u043e\u0449\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u0441\u0430\u043c\u044b\u0435 \u0440\u0430\u0437\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 \u043a\u043e\u0434\u0435, \u043d\u043e \u043f\u0435\u0440\u0432\u044b\u0435 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0438 \u0431\u044b\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u0438 \u0434\u0435\u043b\u0430\u043b\u0438\u0441\u044c \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0441\u0430\u043c\u044b\u0445 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u0445 \u043e\u0448\u0438\u0431\u043e\u043a, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u043e\u043f\u0435\u0447\u0430\u0442\u043a\u0430\u043c\u0438 \u0438 copy-paste \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c. \u041f\u0440\u0438 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435 \u043e\u0442\u0447\u0451\u0442\u0430 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430, \u044f \u0441\u043e\u0440\u0442\u0438\u0440\u0443\u044e \u0435\u0433\u043e \u043f\u043e \u043a\u043e\u0434\u0443 \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 \u043e\u0431\u044b\u0447\u043d\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u044e \u0441\u0432\u043e\u0439 \u0440\u0430\u0441\u0441\u043a\u0430\u0437 \u0441 \u0442\u0430\u043a\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0440\u0430\u0432\u0438\u043b.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/f09\/09f\/a10\/f0909fa10b3c37f41d9180f9fdd784fe.png\" \/><\/div>\n<p>  <a href=\"http:\/\/www.viva64.com\/ru\/d\/0090\/\">V501<\/a> There are identical sub-expressions &#8216;(uintptr_t) b-&gt;handler&#8217; to the left and to the right of the &#8216;&gt;&#8217; operator. ip_fw_sockopt.c 2893  <\/p>\n<pre><code class=\"cpp\">static int compare_sh(const void *_a, const void *_b) {   const struct ipfw_sopt_handler *a, *b;    a = (const struct ipfw_sopt_handler *)_a;   b = (const struct ipfw_sopt_handler *)_b;   ....   if ((uintptr_t)a-&gt;handler &lt; (uintptr_t)b-&gt;handler)     return (-1);   else if ((uintptr_t)b-&gt;handler &gt; (uintptr_t)b-&gt;handler) \/\/ &lt;=     return (1);      return (0); }<\/code><\/pre>\n<p>  \u041d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432\u0440\u0435\u0434\u043d\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u0440\u043e\u0442\u043a\u043e \u0438 \u043d\u0435\u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0432\u043d\u043e. \u0422\u0435\u043f\u0435\u0440\u044c \u0438\u0437-\u0437\u0430 \u043e\u043f\u0435\u0447\u0430\u0442\u043a\u0438 \u0432 \u0431\u0443\u043a\u0432\u0435 &#8216;b&#8217;, \u0447\u0430\u0441\u0442\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0441\u0442\u0430\u0442\u0443\u0441 \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e.<\/p>\n<p>  <a href=\"http:\/\/www.viva64.com\/ru\/d\/0090\/\">V501<\/a> There are identical sub-expressions to the left and to the right of the &#8216;!=&#8217; operator: m-&gt;m_pkthdr.len != m-&gt;m_pkthdr.len key.c 7208  <\/p>\n<pre><code class=\"cpp\">int key_parse(struct mbuf *m, struct socket *so) {   ....   if ((m-&gt;m_flags &amp; M_PKTHDR) == 0 ||       m-&gt;m_pkthdr.len != m-&gt;m_pkthdr.len) { \/\/ &lt;=     ....     goto senderror;   }   .... }<\/code><\/pre>\n<p>  \u041e\u0434\u043d\u043e \u0438\u0437 \u043f\u043e\u043b\u0435\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u043e \u0441 \u0441\u043e\u0431\u043e\u0439, \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u044d\u0442\u043e\u0439 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u0435\u043d False.<\/p>\n<p>  <a href=\"http:\/\/www.viva64.com\/ru\/d\/0090\/\">V501<\/a> There are identical sub-expressions to the left and to the right of the &#8216;|&#8217; operator: PIM_NOBUSRESET | PIM_NOBUSRESET sbp_targ.c 1327  <\/p>\n<pre><code class=\"cpp\">typedef enum {   PIM_EXTLUNS      = 0x100,   PIM_SCANHILO     = 0x80,   PIM_NOREMOVE     = 0x40,   PIM_NOINITIATOR  = 0x20,   PIM_NOBUSRESET   = 0x10, \/\/ &lt;=   PIM_NO_6_BYTE    = 0x08,   PIM_SEQSCAN      = 0x04,   PIM_UNMAPPED     = 0x02,   PIM_NOSCAN       = 0x01 } pi_miscflag;  static void sbp_targ_action1(struct cam_sim *sim, union ccb *ccb) {   ....   struct ccb_pathinq *cpi = &amp;ccb-&gt;cpi;      cpi-&gt;version_num = 1; \/* XXX??? *\/     cpi-&gt;hba_inquiry = PI_TAG_ABLE;     cpi-&gt;target_sprt = PIT_PROCESSOR          | PIT_DISCONNECT          | PIT_TERM_IO;     cpi-&gt;transport = XPORT_SPI;     cpi-&gt;hba_misc = PIM_NOBUSRESET | PIM_NOBUSRESET; \/\/ &lt;=   .... }<\/code><\/pre>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432 \u0431\u0438\u0442\u043e\u0432\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0434\u043d\u0430 \u0438 \u0442\u0430 \u0436\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u00abPIM_NOBUSRESET\u00bb, \u0447\u0442\u043e \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0442\u0443\u0442 \u0445\u043e\u0442\u0435\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443 \u0441 \u0434\u0440\u0443\u0433\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c, \u043d\u043e \u0437\u0430\u0431\u044b\u043b\u0438 \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e.<\/p>\n<p>  <a href=\"http:\/\/www.viva64.com\/ru\/d\/0112\/\">V523<\/a> The &#8216;then&#8217; statement is equivalent to the &#8216;else&#8217; statement. saint.c 2023  <\/p>\n<pre><code class=\"cpp\">GLOBAL void siSMPRespRcvd(....) {   ....   if (agNULL == frameHandle)   {     \/* indirect mode *\/     \/* call back with success *\/     (*(ossaSMPCompletedCB_t)(pRequest-&gt;completionCB))(agRoot,        pRequest-&gt;pIORequestContext, OSSA_IO_SUCCESS, payloadSize,        frameHandle);   }   else   {     \/* direct mode *\/     \/* call back with success *\/     (*(ossaSMPCompletedCB_t)(pRequest-&gt;completionCB))(agRoot,        pRequest-&gt;pIORequestContext, OSSA_IO_SUCCESS, payloadSize,        frameHandle);   }   .... }<\/code><\/pre>\n<p>  \u0414\u0432\u0435 \u0432\u0435\u0442\u0432\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u044b \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u043c\u0438: \/* indirect mode *\/ \u0438 \/* direct mode *\/, \u043d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c, \u0447\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e.<\/p>\n<p>  <a href=\"http:\/\/www.viva64.com\/ru\/d\/0112\/\">V523<\/a> The &#8216;then&#8217; statement is equivalent to the &#8216;else&#8217; statement. smsat.c 2848  <\/p>\n<pre><code class=\"cpp\">osGLOBAL void smsatInquiryPage89(....) {   ....   if (oneDeviceData-&gt;satDeviceType == SATA_ATA_DEVICE)   {     pInquiry[40] = 0x01; \/* LBA Low          *\/     pInquiry[41] = 0x00; \/* LBA Mid          *\/     pInquiry[42] = 0x00; \/* LBA High         *\/     pInquiry[43] = 0x00; \/* Device           *\/     pInquiry[44] = 0x00; \/* LBA Low Exp      *\/     pInquiry[45] = 0x00; \/* LBA Mid Exp      *\/     pInquiry[46] = 0x00; \/* LBA High Exp     *\/     pInquiry[47] = 0x00; \/* Reserved         *\/     pInquiry[48] = 0x01; \/* Sector Count     *\/     pInquiry[49] = 0x00; \/* Sector Count Exp *\/   }   else   {     pInquiry[40] = 0x01; \/* LBA Low          *\/     pInquiry[41] = 0x00; \/* LBA Mid          *\/     pInquiry[42] = 0x00; \/* LBA High         *\/     pInquiry[43] = 0x00; \/* Device           *\/     pInquiry[44] = 0x00; \/* LBA Low Exp      *\/     pInquiry[45] = 0x00; \/* LBA Mid Exp      *\/     pInquiry[46] = 0x00; \/* LBA High Exp     *\/     pInquiry[47] = 0x00; \/* Reserved         *\/     pInquiry[48] = 0x01; \/* Sector Count     *\/     pInquiry[49] = 0x00; \/* Sector Count Exp *\/   }   .... }<\/code><\/pre>\n<p>  \u042d\u0442\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0435\u0449\u0451 \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439, \u0447\u0435\u043c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439. \u0421\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d \u0442\u0430\u043a\u043e\u0439 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u043a\u043e\u0434\u0430, \u043d\u043e \u043f\u043e\u0442\u043e\u043c \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439.<\/p>\n<p>  <a href=\"http:\/\/www.viva64.com\/ru\/d\/0137\/\">V547<\/a> Expression is always true. Probably the &#8216;&amp;&amp;&#8217; operator should be used here. qla_hw.c 799  <\/p>\n<pre><code class=\"cpp\">static int qla_tx_tso(qla_host_t *ha, struct mbuf *mp, ....) {   ....   if ((*tcp_opt != 0x01) || (*(tcp_opt + 1) != 0x01) ||     (*(tcp_opt + 2) != 0x08) || (*(tcp_opt + 2) != 10)) { \/\/ &lt;=     return -1;   }   .... }<\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b, \u0447\u0442\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0435 &quot;(*(tcp_opt + 2) != 0x08) || (*(tcp_opt + 2) != 10)&quot; \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u0441\u0442\u0438\u043d\u043d\u043e \u0438 \u044d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u0430\u043a, \u0435\u0441\u043b\u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438\u0441\u0442\u0438\u043d\u043d\u043e\u0441\u0442\u0438. \u041d\u043e, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0437\u0434\u0435\u0441\u044c \u043d\u0435 \u043d\u0443\u0436\u0435\u043d \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 &#8216;&amp;&amp;&#8217;, \u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u043e\u043f\u0435\u0447\u0430\u0442\u043a\u0443 \u0432 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0438 \u0430\u0434\u0440\u0435\u0441\u0430. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u043b \u0431\u044b\u0442\u044c \u0442\u0430\u043a\u0438\u043c:  <\/p>\n<pre><code class=\"cpp\">static int qla_tx_tso(qla_host_t *ha, struct mbuf *mp, ....) {   ....   if ((*tcp_opt != 0x01) || (*(tcp_opt + 1) != 0x01) ||     (*(tcp_opt + 2) != 0x08) || (*(tcp_opt + 3) != 10)) {     return -1;   }   .... }<\/code><\/pre>\n<p>  <a href=\"http:\/\/www.viva64.com\/ru\/d\/0169\/\">V571<\/a> Recurring check. This condition was already verified in line 1946. sahw.c 1949  <\/p>\n<pre><code class=\"cpp\">GLOBAL bit32 siHDAMode_V(....) {   ....   if( saRoot-&gt;memoryAllocated.agMemory[i].totalLength &gt; biggest)   {     if(biggest &lt; saRoot-&gt;memoryAllocated.agMemory[i].totalLength)     {       save = i;       biggest = saRoot-&gt;memoryAllocated.agMemory[i].totalLength;     }   }   .... }<\/code><\/pre>\n<p>  \u041e\u0447\u0435\u043d\u044c \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434, \u0435\u0441\u043b\u0438 \u0435\u0433\u043e \u0443\u0441\u043b\u043e\u0432\u043d\u043e \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c, \u0442\u043e \u0443\u0432\u0438\u0434\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:  <\/p>\n<pre><code class=\"cpp\">if( A &gt; B ) {   if (B &lt; A)   {     ....   } }<\/code><\/pre>\n<p>  \u0414\u0432\u0430 \u0440\u0430\u0437\u0430 \u043f\u043e\u0434\u0440\u044f\u0434 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u043e \u0438 \u0442\u043e\u0436\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435. \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0442\u0443\u0442 \u0445\u043e\u0442\u0435\u043b\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0439 \u043a\u043e\u0434.<\/p>\n<p>  \u0415\u0449\u0451 \u043f\u043e\u0445\u043e\u0436\u0435\u0435 \u043c\u0435\u0441\u0442\u043e:<\/p>\n<ul>\n<li>V571 Recurring check. This condition was already verified in line 1940. if_rl.c 1941<\/li>\n<\/ul>\n<p>  <\/p>\n<h2>\u041e\u043f\u0430\u0441\u043d\u044b\u0435 \u043c\u0430\u043a\u0440\u043e\u0441\u044b<\/h2>\n<p>  <a href=\"http:\/\/www.viva64.com\/ru\/d\/0112\/\">V523<\/a> The &#8216;then&#8217; statement is equivalent to the &#8216;else&#8217; statement. agtiapi.c 829  <\/p>\n<pre><code class=\"cpp\">if (osti_strncmp(buffer, &quot;0x&quot;, 2) == 0) {    maxTargets = osti_strtoul (buffer, &amp;pLastUsedChar, 0);   AGTIAPI_PRINTK( &quot;.... maxTargets = osti_strtoul  0 \\n&quot; ); } else {   maxTargets = osti_strtoul (buffer, &amp;pLastUsedChar, 10);   AGTIAPI_PRINTK( &quot;.... maxTargets = osti_strtoul 10\\n&quot;   ); }<\/code><\/pre>\n<p>  \u042d\u0442\u043e \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u044f \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u043b, \u0440\u0435\u0448\u0438\u0432, \u0447\u0442\u043e \u044d\u0442\u043e \u043b\u043e\u0436\u043d\u043e\u0435 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u044f. \u041d\u043e \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043b\u043e\u0436\u043d\u044b\u0435 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u043d\u0430\u0434\u043e \u0438\u0437\u0443\u0447\u0430\u0442\u044c \u0438 \u0443\u043b\u0443\u0447\u0448\u0430\u0442\u044c \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440. \u0427\u0435\u043c \u044f \u0438 \u0437\u0430\u043d\u044f\u043b\u0441\u044f, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u043b \u0442\u0430\u043a\u043e\u0439 \u043c\u0430\u043a\u0440\u043e\u0441:  <\/p>\n<pre><code class=\"cpp\">#define osti_strtoul(nptr, endptr, base)    \\           strtoul((char *)nptr, (char **)endptr, 0)<\/code><\/pre>\n<p>  \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 &#8216;base&#8217; \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f, \u0430 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u00abstrtoul\u00bb \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 &#8216;0&#8217;. \u0425\u043e\u0442\u044f \u0432 \u043c\u0430\u043a\u0440\u043e\u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f &#8216;0&#8217; \u0438 &#8217;10&#8217;. \u0412 \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u0432\u0441\u0435 \u043c\u0430\u043a\u0440\u043e\u0441\u044b \u0440\u0430\u0441\u043a\u0440\u044b\u043b\u0438\u0441\u044c, \u0438 \u043a\u043e\u0434 \u0441\u0442\u0430\u043b \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c. \u042d\u0442\u043e\u0442 \u043c\u0430\u043a\u0440\u043e\u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u0435\u0441\u044f\u0442\u043a\u043e\u0432 \u0440\u0430\u0437. \u0412\u0435\u0441\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0442\u0430\u043a\u0438\u0445 \u043c\u0435\u0441\u0442 \u044f \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u043b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c.<\/p>\n<p>  <a href=\"http:\/\/www.viva64.com\/ru\/d\/0380\">V733<\/a> It is possible that macro expansion resulted in incorrect evaluation order. Check expression: chan \u2014 1 * 20. isp.c 2301  <\/p>\n<pre><code class=\"cpp\">static void isp_fibre_init_2400(ispsoftc_t *isp) {   ....   if (ISP_CAP_VP0(isp))     off += ICB2400_VPINFO_PORT_OFF(chan);   else     off += ICB2400_VPINFO_PORT_OFF(chan - 1); \/\/ &lt;=   .... }<\/code><\/pre>\n<p>  \u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u0432 \u044d\u0442\u043e\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u043a\u043e\u0434\u0430 \u043d\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e. \u0418\u043d\u043e\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 &#8216;chan&#8217;, \u0438\u043d\u043e\u0433\u0434\u0430 \u043d\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443 \u043c\u0435\u043d\u044c\u0448\u0435: &#8216;chan \u2014 1&#8217;, \u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043c\u0430\u043a\u0440\u043e\u0441\u0430:  <\/p>\n<pre><code class=\"cpp\">#define ICB2400_VPOPT_WRITE_SIZE 20  #define  ICB2400_VPINFO_PORT_OFF(chan) \\   (ICB2400_VPINFO_OFF +                \\    sizeof (isp_icb_2400_vpinfo_t) +    \\   (chan * ICB2400_VPOPT_WRITE_SIZE))          \/\/ &lt;=<\/code><\/pre>\n<p>  \u041f\u0440\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0432 \u043c\u0430\u043a\u0440\u043e\u0441 \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u0442\u0430\u043c \u043a\u0430\u0440\u0434\u0438\u043d\u0430\u043b\u044c\u043d\u043e \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439. \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u043c\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 &quot;(chan \u2014 1) * 20&quot; \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u00abchan \u2014 1 *20\u00bb, \u0442.\u0435. \u0432 \u00abchan \u2014 20\u00bb, \u0438 \u0434\u0430\u043b\u0435\u0435 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u0432\u0435\u0440\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440.<\/p>\n<h2>\u041e \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u0430\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439<\/h2>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u044b \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u0438\u0448\u043d\u0438\u0435 \u0441\u043a\u043e\u0431\u043a\u0438, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0443\u0432\u0435\u0440\u0435\u043d, \u0438 \u0438\u043d\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0441\u0435\u0431\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438\u0441\u0442\u0438\u043d\u043d\u043e\u0441\u0442\u0438 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/531\/122\/ff3\/531122ff373bd771bc6d603e2394a906.png\" \/><\/div>\n<p>  <a href=\"http:\/\/www.viva64.com\/ru\/d\/0091\/\">V502<\/a> Perhaps the &#8216;?:&#8217; operator works in a different way than it was expected. The &#8216;?:&#8217; operator has a lower priority than the &#8216;|&#8217; operator. ata-serverworks.c 166  <\/p>\n<pre><code class=\"cpp\">ata_serverworks_chipinit(device_t dev) {   ....   pci_write_config(dev, 0x5a,            (pci_read_config(dev, 0x5a, 1) &amp; ~0x40) |            (ctlr-&gt;chip-&gt;cfg1 == SWKS_100) ? 0x03 : 0x02, 1);   }   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 &#8216;?:&#8217; \u043d\u0438\u0436\u0435 \u043f\u043e\u0431\u0438\u0442\u043e\u0432\u043e\u0433\u043e \u0418\u041b\u0418 &#8216;|&#8217;. \u0412 \u0438\u0442\u043e\u0433\u0435, \u0432 \u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u0445, \u043a\u0440\u043e\u043c\u0435 \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0445 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442, \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u0435\u0442 \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f &quot;(ctlr-&gt;chip-&gt;cfg1 == SWKS_100)&quot;, \u0447\u0442\u043e \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e \u043c\u0435\u043d\u044f\u0435\u0442 \u043b\u043e\u0433\u0438\u043a\u0443 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432 \u044d\u0442\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u0447\u0430\u0441\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043f\u043e\u0445\u043e\u0436\u0438\u0439 \u043d\u0430 \u043f\u0440\u0430\u0432\u0434\u0443, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u0430\u043a\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443 \u0435\u0449\u0451 \u043d\u0435 \u0437\u0430\u043c\u0435\u0442\u0438\u043b\u0438.<\/p>\n<p>  <a href=\"http:\/\/www.viva64.com\/ru\/d\/0091\/\">V502<\/a> Perhaps the &#8216;?:&#8217; operator works in a different way than it was expected. The &#8216;?:&#8217; operator has a lower priority than the &#8216;|&#8217; operator. in6.c 1318  <\/p>\n<pre><code class=\"cpp\">void in6_purgeaddr(struct ifaddr *ifa) {   ....   error = rtinit(&amp;(ia-&gt;ia_ifa), RTM_DELETE, ia-&gt;ia_flags |         (ia-&gt;ia_dstaddr.sin6_family == AF_INET6) ? RTF_HOST : 0);   .... }<\/code><\/pre>\n<p>  \u0412 \u0434\u0440\u0443\u0433\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u0442\u043e\u0436\u0435 \u043d\u0430\u0448\u043b\u043e\u0441\u044c \u043c\u0435\u0441\u0442\u043e \u0441 \u043f\u043e\u0445\u043e\u0436\u0435\u0439 \u043e\u0448\u0438\u0431\u043a\u043e\u0439 \u0441 \u0442\u0435\u0440\u043d\u0430\u0440\u043d\u044b\u043c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c.<\/p>\n<p>  <a href=\"http:\/\/www.viva64.com\/ru\/d\/0137\/\">V547<\/a> Expression &#8216;cdb[0] != 0x28 || cdb[0] != 0x2A&#8217; is always true. Probably the &#8216;&amp;&amp;&#8217; operator should be used here. mfi_tbolt.c 1110  <\/p>\n<pre><code class=\"cpp\">int mfi_tbolt_send_frame(struct mfi_softc *sc, struct mfi_command *cm) {   ....   if (cdb[0] != 0x28 || cdb[0] != 0x2A) {  \/\/ &lt;='     if ((req_desc = mfi_tbolt_build_mpt_cmd(sc, cm)) == NULL) {       device_printf(sc-&gt;mfi_dev, &quot;Mapping from MFI &quot;           &quot;to MPT Failed \\n&quot;);       return 1;     }   }   else     device_printf(sc-&gt;mfi_dev, &quot;DJA NA XXX SYSPDIO\\n&quot;);   .... }<\/code><\/pre>\n<p>  \u0422\u0443\u0442 \u043f\u0435\u0440\u0432\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u0441\u0442\u0438\u043d\u043d\u043e, \u0438\u0437-\u0437\u0430 \u0447\u0435\u0433\u043e \u0432\u0435\u0442\u0432\u044c &#8216;else&#8217; \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f. \u0414\u043b\u044f \u0434\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 \u044d\u0442\u043e\u043c \u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u044f \u0431\u0443\u0434\u0443 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438\u0441\u0442\u0438\u043d\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u0441\u043f\u043e\u0440\u043d\u044b\u0445 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439. \u041f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/4f4\/acd\/3a0\/4f4acd3a0bc722f9ca7d06b784a11ae9.png\" \/><\/div>\n<p>  <a href=\"http:\/\/www.viva64.com\/ru\/d\/0194\/\">V590<\/a> Consider inspecting the &#8216;error == 0 || error != \u2014 1&#8217; expression. The expression is excessive or contains a misprint. nd6.c 2119  <\/p>\n<pre><code class=\"cpp\">int nd6_output_ifp(....) {   ....   \/* Use the SEND socket *\/   error = send_sendso_input_hook(m, ifp, SND_OUT,       ip6len);   \/* -1 == no app on SEND socket *\/   if (error == 0 || error != -1)           \/\/ &lt;=       return (error);   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u044d\u0442\u043e\u0433\u043e \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430 \u043a\u043e\u0434\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u00aberror == 0\u00bb. \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0447\u0442\u043e-\u0442\u043e \u0442\u0443\u0442 \u043d\u0435 \u0442\u0430\u043a:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/a78\/fad\/7cd\/a78fad7cd95ced9d8557b02a31ecb727.png\" \/><\/div>\n<p>  \u0415\u0449\u0451 \u0442\u0440\u0438 \u0441\u043b\u0443\u0447\u0430\u044f:<\/p>\n<ul>\n<li>V590 Consider inspecting the &#8216;error == 0 || error != 35&#8217; expression. The expression is excessive or contains a misprint. if_ipw.c 1855<\/li>\n<li>V590 Consider inspecting the &#8216;error == 0 || error != 27&#8217; expression. The expression is excessive or contains a misprint. if_vmx.c 2747<\/li>\n<li>V547 Expression is always true. Probably the &#8216;&amp;&amp;&#8217; operator should be used here. igmp.c 1939<\/li>\n<\/ul>\n<p>  V590 Consider inspecting this expression. The expression is excessive or contains a misprint. sig_verify.c 94  <\/p>\n<pre><code class=\"cpp\">enum uni_ieact {   UNI_IEACT_CLEAR = 0x00, \/* clear call *\/   .... }  void uni_mandate_epref(struct uni *uni, struct uni_ie_epref *epref) {   ....   maxact = -1;   FOREACH_ERR(e, uni) {     if (e-&gt;ie == UNI_IE_EPREF)       continue;     if (e-&gt;act == UNI_IEACT_CLEAR)       maxact = UNI_IEACT_CLEAR;     else if (e-&gt;act == UNI_IEACT_MSG_REPORT) {       if (maxact == -1 &amp;&amp; maxact != UNI_IEACT_CLEAR)     \/\/ &lt;=         maxact = UNI_IEACT_MSG_REPORT;     } else if (e-&gt;act == UNI_IEACT_MSG_IGNORE) {       if (maxact == -1)         maxact = UNI_IEACT_MSG_IGNORE;     }   }   .... }<\/code><\/pre>\n<p>  \u0422\u0443\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u0441\u0435\u0433\u043e \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u00abmaxact != UNI_IEACT_CLEAR\u00bb. \u0412\u043e\u0442 \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/a19\/8ae\/e30\/a198aee3071f6fef759486374920b47c.png\" \/><\/div>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0433\u043b\u0430\u0432\u0435 \u044f \u043f\u0440\u0438\u0432\u0451\u043b \u0446\u0435\u043b\u044b\u0445 3 \u0441\u043f\u043e\u0441\u043e\u0431\u0430, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043e\u0448\u0438\u0431\u0438\u0442\u044c\u0441\u044f \u0432, \u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0444\u043e\u0440\u043c\u0443\u043b\u0430\u0445. \u0417\u0430\u0434\u0443\u043c\u0430\u0439\u0442\u0435\u0441\u044c\u2026<\/p>\n<p>  <a href=\"http:\/\/www.viva64.com\/ru\/d\/0197\/\">V593<\/a> Consider reviewing the expression of the &#8216;A = B != C&#8217; kind. The expression is calculated as following: &#8216;A = (B != C)&#8217;. aacraid.c 2854  <\/p>\n<pre><code class=\"cpp\">#define EINVAL 22 \/* Invalid argument *\/ #define EFAULT 14 \/* Bad address *\/ #define EPERM 1 \/* Operation not permitted *\/  static int aac_ioctl_send_raw_srb(struct aac_softc *sc, caddr_t arg) {   ....   int error, transfer_data = 0;   ....   if ((error = copyin((void *)&amp;user_srb-&gt;data_len, &amp;fibsize,      sizeof (u_int32_t)) != 0))      goto out;   if (fibsize &gt; (sc-&gt;aac_max_fib_size-sizeof(....))) {     error = EINVAL;     goto out;   }   if ((error = copyin((void *)user_srb, srbcmd, fibsize) != 0))      goto out;   .... out:   ....   return(error); }<\/code><\/pre>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u0440\u0442\u0438\u0442\u0441\u044f \u043a\u043e\u0434 \u043e\u0448\u0438\u0431\u043a\u0438, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u0435 \u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0435 &#8216;if&#8217;. \u0422.\u0435. \u0432 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u00aberror = copyin(&#8230;) != 0\u00bb \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u00abcopyin(&#8230;) != 0\u00bb, \u0430 \u043f\u043e\u0442\u043e\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 (\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 0 \u0438\u043b\u0438 1) \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e &#8216;error&#8217;.<\/p>\n<p>  \u0412 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043a \u0444\u0443\u043d\u043a\u0446\u0438\u0438 &#8216;copyin&#8217; \u0441\u043a\u0430\u0437\u0430\u043d\u043e, \u0447\u0442\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u043e\u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043a\u043e\u0434 EFAULT (\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 14), \u0430 \u043f\u043e\u0441\u043b\u0435 \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0432 \u043a\u043e\u0434 \u043e\u0448\u0438\u0431\u043a\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u0440\u0430\u0432\u043d\u044b\u0439 &#8216;1&#8217;, \u0430 \u044d\u0442\u043e \u0443\u0436\u0435 EPERM \u2014 \u0441\u043e\u0432\u0441\u0435\u043c \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u0430\u0442\u0443\u0441 \u043e\u0448\u0438\u0431\u043a\u0438.<\/p>\n<p>  \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0442\u0430\u043a\u0438\u0445 \u043c\u0435\u0441\u0442 \u043c\u043d\u043e\u0433\u043e:<\/p>\n<ul>\n<li>V593 Consider reviewing the expression of the &#8216;A = B != C&#8217; kind. The expression is calculated as following: &#8216;A = (B != C)&#8217;. aacraid.c 2861<\/li>\n<li>V593 Consider reviewing the expression of the &#8216;A = B != C&#8217; kind. The expression is calculated as following: &#8216;A = (B != C)&#8217;. if_age.c 591<\/li>\n<li>V593 Consider reviewing the expression of the &#8216;A = B != C&#8217; kind. The expression is calculated as following: &#8216;A = (B != C)&#8217;. if_alc.c 1535<\/li>\n<li>V593 Consider reviewing the expression of the &#8216;A = B != C&#8217; kind. The expression is calculated as following: &#8216;A = (B != C)&#8217;. if_ale.c 606<\/li>\n<li>V593 Consider reviewing the expression of the &#8216;A = B != C&#8217; kind. The expression is calculated as following: &#8216;A = (B != C)&#8217;. if_jme.c 807<\/li>\n<li>V593 Consider reviewing the expression of the &#8216;A = B != C&#8217; kind. The expression is calculated as following: &#8216;A = (B != C)&#8217;. if_msk.c 1626<\/li>\n<li>V593 Consider reviewing the expression of the &#8216;A = B != C&#8217; kind. The expression is calculated as following: &#8216;A = (B != C)&#8217;. if_stge.c 511<\/li>\n<li>V593 Consider reviewing the expression of the &#8216;A = B != C&#8217; kind. The expression is calculated as following: &#8216;A = (B != C)&#8217;. hunt_filter.c 973<\/li>\n<li>V593 Consider reviewing the expression of the &#8216;A = B != C&#8217; kind. The expression is calculated as following: &#8216;A = (B != C)&#8217;. if_smsc.c 1365<\/li>\n<li>V593 Consider reviewing the expression of the &#8216;A = B != C&#8217; kind. The expression is calculated as following: &#8216;A = (B != C)&#8217;. if_vte.c 431<\/li>\n<li>V593 Consider reviewing the expression of the &#8216;A = B != C&#8217; kind. The expression is calculated as following: &#8216;A = (B != C)&#8217;. zfs_vfsops.c 498<\/li>\n<\/ul>\n<p>  <\/p>\n<h2>\u0421\u0442\u0440\u043e\u043a\u0438<\/h2>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/ab1\/efc\/b71\/ab1efcb71b9263febcd5845db4590e3c.png\" \/><\/div>\n<p>  <a href=\"http:\/\/www.viva64.com\/ru\/d\/0130\/\">V541<\/a> It is dangerous to print the string &#8216;buffer&#8217; into itself. ata-highpoint.c 102  <\/p>\n<pre><code class=\"cpp\">static int ata_highpoint_probe(device_t dev) {   ....   char buffer[64];   ....   strcpy(buffer, &quot;HighPoint &quot;);   strcat(buffer, idx-&gt;text);   if (idx-&gt;cfg1 == HPT_374) {   if (pci_get_function(dev) == 0)       strcat(buffer, &quot; (channel 0+1)&quot;);   if (pci_get_function(dev) == 1)       strcat(buffer, &quot; (channel 2+3)&quot;);   }   sprintf(buffer, &quot;%s %s controller&quot;,     buffer, ata_mode2str(idx-&gt;max_dma));   .... }<\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0442 \u043d\u0435\u043a\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u0431\u0443\u0444\u0435\u0440\u0435. \u041f\u043e\u0442\u043e\u043c \u0445\u043e\u0442\u044f\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443, \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438, \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a \u043d\u0435\u0439 \u0435\u0449\u0451 \u0434\u0432\u0430 \u0441\u043b\u043e\u0432\u0430. \u0412\u0440\u043e\u0434\u0435 \u0432\u0441\u0451 \u043f\u0440\u043e\u0441\u0442\u043e.<\/p>\n<p>  \u0414\u043b\u044f \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f, \u043f\u043e\u0447\u0435\u043c\u0443 \u0437\u0434\u0435\u0441\u044c \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u044f \u043f\u0440\u043e\u0446\u0438\u0442\u0438\u0440\u0443\u044e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043a \u044d\u0442\u043e\u0439 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0435:  <\/p>\n<pre><code class=\"cpp\">char s[100] = &quot;test&quot;; sprintf(s, &quot;N = %d, S = %s&quot;, 123, s);<\/code><\/pre>\n<p>  \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443:  <\/p>\n<pre><code class=\"cpp\">N = 123, S = test<\/code><\/pre>\n<p>  \u041d\u043e \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0432 \u0431\u0443\u0444\u0435\u0440\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0430:  <\/p>\n<pre><code class=\"cpp\">N = 123, S = N = 123, S =<\/code><\/pre>\n<p>  \u0412 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u0445 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u043a\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043a \u0432\u044b\u0432\u043e\u0434\u0443 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430, \u043d\u043e \u0438 \u043a \u0430\u0432\u0430\u0440\u0438\u0439\u043d\u043e\u043c\u0443 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u041a\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d, \u0435\u0441\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u043d\u043e\u0432\u044b\u0439 \u0431\u0443\u0444\u0435\u0440. \u041a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442:  <\/p>\n<pre><code class=\"cpp\">char s1[100] = &quot;test&quot;; char s2[100]; sprintf(s2, &quot;N = %d, S = %s&quot;, 123, s1);<\/code><\/pre>\n<p>  <a href=\"http:\/\/www.viva64.com\/ru\/d\/0101\/\">V512<\/a> A call of the &#8216;strcpy&#8217; function will lead to overflow of the buffer &#8216;p-&gt;vendor&#8217;. aacraid_cam.c 571  <\/p>\n<pre><code class=\"cpp\">#define  SID_VENDOR_SIZE   8   char   vendor[SID_VENDOR_SIZE]; #define  SID_PRODUCT_SIZE  16   char   product[SID_PRODUCT_SIZE]; #define  SID_REVISION_SIZE 4   char   revision[SID_REVISION_SIZE];  static void aac_container_special_command(struct cam_sim *sim, union ccb *ccb,   u_int8_t *cmdp) {   ....   \/* OEM Vendor defines *\/   strcpy(p-&gt;vendor,&quot;Adaptec &quot;);          \/\/ &lt;=   strcpy(p-&gt;product,&quot;Array           &quot;); \/\/ &lt;=   strcpy(p-&gt;revision,&quot;V1.0&quot;);            \/\/ &lt;=   .... }<\/code><\/pre>\n<p>  \u0412\u0441\u0435 \u0442\u0440\u0438 \u0441\u0442\u0440\u043e\u043a\u0438 \u0437\u0434\u0435\u0441\u044c \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043d\u0435\u0432\u0435\u0440\u043d\u043e. \u0412 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u0445 \u043d\u0435\u0442 \u043c\u0435\u0441\u0442\u0430 \u0434\u043b\u044f <a href=\"http:\/\/www.viva64.com\/ru\/t\/0088\/\">null-\u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430<\/a>, \u0438\u0437-\u0437\u0430 \u0447\u0435\u0433\u043e \u043c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0442\u044c \u0441\u0435\u0440\u044c\u0451\u0437\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043f\u0440\u0438 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0442\u0430\u043a\u0438\u043c\u0438 \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u00abp-&gt;vendor\u00bb \u0438 \u00abp-&gt;product\u00bb \u043c\u043e\u0436\u043d\u043e \u0443\u0431\u0440\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0431\u0435\u043b. \u0422\u043e\u0433\u0434\u0430 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u0441\u044f \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043d\u043e\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u044f strcpy() \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 \u043a\u043e\u043d\u0435\u0446 \u0441\u0442\u0440\u043e\u043a\u0438. \u0410 \u0432\u043e\u0442 \u0434\u043b\u044f \u00abp-&gt;revision\u00bb \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u0442 \u043c\u0435\u0441\u0442\u0430 \u0434\u043b\u044f \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u043a\u043e\u043d\u0446\u0430 \u0441\u0442\u0440\u043e\u043a\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u0434\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 SID_REVISION_SIZE \u0445\u043e\u0442\u044f \u0431\u044b \u043d\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443.<\/p>\n<p>  \u041c\u043d\u0435, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0441\u043b\u043e\u0436\u043d\u043e \u0441\u0443\u0434\u0438\u0442\u044c \u043e\u0431 \u044d\u0442\u043e\u043c \u043a\u043e\u0434\u0435. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043d\u043e\u043b\u044c \u0438 \u043d\u0435 \u043d\u0443\u0436\u0435\u043d, \u0438 \u0432\u0441\u0451 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u043e \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0431\u0443\u0444\u0435\u0440\u0430. \u0422\u043e\u0433\u0434\u0430 \u043d\u0435\u0432\u0435\u0440\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f strcpy(). \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043b\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u043a-\u0442\u043e \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"cpp\">memcpy(p-&gt;vendor,   &quot;Adaptec &quot;,         SID_VENDOR_SIZE); memcpy(p-&gt;product,  &quot;Array           &quot;, SID_PRODUCT_SIZE); memcpy(p-&gt;revision, &quot;V1.0&quot;,             SID_REVISION_SIZE);<\/code><\/pre>\n<p>  <a href=\"http:\/\/www.viva64.com\/ru\/d\/0186\/\">V583<\/a> The &#8216;?:&#8217; operator, regardless of its conditional expression, always returns one and the same value: td-&gt;td_name. subr_turnstile.c 1029  <\/p>\n<pre><code class=\"cpp\">static void print_thread(struct thread *td, const char *prefix) {   db_printf(&quot;%s%p (tid %d, pid %d, ....&quot;, prefix, td, td-&gt;td_tid,       td-&gt;td_proc-&gt;p_pid, td-&gt;td_name[0] != '\\0' ? td-&gt;td_name :       td-&gt;td_name); }<\/code><\/pre>\n<p>  \u041f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043c\u0435\u0441\u0442\u043e. \u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u00abtd-&gt;td_name[0] != &#8216;\\0&#8217;\u00bb, \u044d\u0442\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0432\u044b\u0432\u043e\u0434\u044f\u0442 \u043d\u0430 \u043f\u0435\u0447\u0430\u0442\u044c.<\/p>\n<p>  \u0412\u0441\u0435 \u0442\u0430\u043a\u0438\u0435 \u043c\u0435\u0441\u0442\u0430:<\/p>\n<ul>\n<li>V583 The &#8216;?:&#8217; operator, regardless of its conditional expression, always returns one and the same value: td-&gt;td_name. subr_turnstile.c 1112<\/li>\n<li>V583 The &#8216;?:&#8217; operator, regardless of its conditional expression, always returns one and the same value: td-&gt;td_name. subr_turnstile.c 1196<\/li>\n<\/ul>\n<p>  <\/p>\n<h2>\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u043f\u0430\u043c\u044f\u0442\u044c\u044e<\/h2>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439:  <\/p>\n<pre><code class=\"cpp\">void bzero(void *b, size_t len);<\/code><\/pre>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f bzero() \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043d\u0443\u043b\u044f\u043c\u0438 &#8216;len&#8217; \u0431\u0430\u0439\u0442 \u043f\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044e &#8216;b&#8217;.  <\/p>\n<pre><code class=\"cpp\">int copyout(const void *kaddr, void *uaddr, size_t len);<\/code><\/pre>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f copyout() \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442 &#8216;len&#8217; \u0431\u0430\u0439\u0442 \u0438\u0437 &#8216;kaddr&#8217; \u0432 &#8216;uaddr&#8217;.<\/p>\n<p>  <a href=\"http:\/\/www.viva64.com\/ru\/d\/0181\/\">V579<\/a> The bzero function receives the pointer and its size as arguments. It is possibly a mistake. Inspect the second argument. osapi.c 316  <\/p>\n<pre><code class=\"cpp\">\/* Autosense storage *\/   struct scsi_sense_data sense_data;  void ostiInitiatorIOCompleted(....) {   ....   bzero(&amp;csio-&gt;sense_data, sizeof(&amp;csio-&gt;sense_data));   .... }<\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043e\u0431\u043d\u0443\u043b\u0438\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e bzero() \u043d\u0430\u0434\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0438 \u0440\u0430\u0437\u043c\u0435\u0440 \u043e\u0431\u043d\u0443\u043b\u044f\u0435\u043c\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0432 \u0431\u0430\u0439\u0442\u0430\u0445, \u043d\u043e \u0442\u0443\u0442 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f, \u0430 \u043d\u0435 \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b.<\/p>\n<p>  \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"cpp\">bzero(&amp;csio-&gt;sense_data, sizeof(csio-&gt;sense_data));<\/code><\/pre>\n<p>  <a href=\"http:\/\/www.viva64.com\/ru\/d\/0181\/\">V579<\/a> The bzero function receives the pointer and its size as arguments. It is possibly a mistake. Inspect the second argument. acpi_package.c 83  <\/p>\n<pre><code class=\"cpp\">int acpi_PkgStr(...., void *dst, ....) {   ....   bzero(dst, sizeof(dst));   .... }<\/code><\/pre>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u043e\u0445\u043e\u0436\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f: \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e &#8216;bzero&#8217; \u043e\u043f\u044f\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u043b\u0438 \u0440\u0430\u0437\u043c\u0435\u0440 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f, \u0430 \u043d\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430.<\/p>\n<p>  \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"cpp\">bzero(dst, sizeof(*dst));<\/code><\/pre>\n<p>  <a href=\"http:\/\/www.viva64.com\/ru\/d\/0181\/\">V579<\/a> The copyout function receives the pointer and its size as arguments. It is possibly a mistake. Inspect the third argument. if_nxge.c 1498  <\/p>\n<pre><code class=\"cpp\">int xge_ioctl_stats(xge_lldev_t *lldev, struct ifreq *ifreqp) {   ....   *data = (*data == XGE_SET_BUFFER_MODE_1) ? 'Y':'N';   if(copyout(data, ifreqp-&gt;ifr_data, sizeof(data)) == 0)    \/\/ &lt;=       retValue = 0;   break;   .... }<\/code><\/pre>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043a\u043e\u043f\u0438\u0440\u0443\u044e\u0442 \u043f\u0430\u043c\u044f\u0442\u044c \u0438\u0437 &#8216;data&#8217; \u0432 &#8216;ifreqp-&gt;ifr_data&#8217;, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u043c\u0435\u0440 \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0440\u0430\u0432\u0435\u043d sizeof(data), \u0442.\u0435. 4 \u0438\u043b\u0438 8 \u0431\u0430\u0439\u0442 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0440\u0430\u0437\u0440\u044f\u0434\u043d\u043e\u0441\u0442\u0438 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b.<\/p>\n<h2>\u0423\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438<\/h2>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/9ba\/19a\/9cb\/9ba19a9cbd2ef8c414255107797e978e.png\" \/><\/div>\n<p>  <a href=\"http:\/\/www.viva64.com\/ru\/d\/0148\/\">V557<\/a> Array overrun is possible. The &#8216;2&#8217; index is pointing beyond array bound. if_spppsubr.c 4348  <\/p>\n<pre><code class=\"cpp\">#define AUTHKEYLEN  16  struct sauth {   u_short  proto;      \/* authentication protocol to use *\/   u_short  flags; #define AUTHFLAG_NOCALLOUT  1             \/* callouts *\/ #define AUTHFLAG_NORECHALLENGE  2  \/* do not re-challenge CHAP *\/   u_char  name[AUTHNAMELEN];  \/* system identification name *\/   u_char  secret[AUTHKEYLEN];  \/* secret password *\/   u_char  challenge[AUTHKEYLEN];  \/* random challenge *\/ };  static void sppp_chap_scr(struct sppp *sp) {   u_long *ch, seed;   u_char clen;    \/* Compute random challenge. *\/   ch = (u_long *)sp-&gt;myauth.challenge;   read_random(&amp;seed, sizeof seed);   ch[0] = seed ^ random();   ch[1] = seed ^ random();   ch[2] = seed ^ random(); \/\/ &lt;=   ch[3] = seed ^ random(); \/\/ &lt;=   clen = AUTHKEYLEN;   .... }<\/code><\/pre>\n<p>  \u0420\u0430\u0437\u043c\u0435\u0440 \u0442\u0438\u043f\u0430 &#8216;u_char&#8217; \u2014 1 \u0431\u0430\u0439\u0442 \u0432 32-\u0445 \u0438 64-\u0445 \u0431\u0438\u0442\u043d\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445, \u0430 \u0440\u0430\u0437\u043c\u0435\u0440 \u0442\u0438\u043f\u0430 &#8216;u_long&#8217; \u2014 4 \u0431\u0430\u0439\u0442\u0430 \u0432 32-\u0445 \u0431\u0438\u0442\u043d\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0438 8 \u0431\u0430\u0439\u0442 \u0432 64-\u0445 \u0431\u0438\u0442\u043d\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438. \u0422\u043e\u0433\u0434\u0430 \u0432 32-\u0445 \u0431\u0438\u0442\u043d\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u00abu_long* ch = (u_long *)sp-&gt;myauth.challenge\u00bb \u043c\u0430\u0441\u0441\u0438\u0432 &#8216;ch&#8217; \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u044c \u0438\u0437 4-\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u043e 4 \u0431\u0430\u0439\u0442\u0430. \u0410 \u0432 64-\u0445 \u0431\u0438\u0442\u043d\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043c\u0430\u0441\u0441\u0438\u0432 &#8216;ch&#8217; \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u044c \u0438\u0437 2-\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u043e 8 \u0431\u0430\u0439\u0442. \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0435\u0441\u043b\u0438 \u043c\u044b \u0441\u043e\u0431\u0435\u0440\u0451\u043c 64-\u0431\u0438\u0442\u043d\u043e\u0435 \u044f\u0434\u0440\u043e, \u0442\u043e \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a ch[2] \u0438 ch[3] \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u044b\u0445\u043e\u0434 \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u043c\u0430\u0441\u0441\u0438\u0432\u0430.<\/p>\n<p>  <a href=\"http:\/\/www.viva64.com\/ru\/d\/0092\/\">V503<\/a> This is a nonsensical comparison: pointer &gt;= 0. geom_vinum_plex.c 173  <\/p>\n<pre><code class=\"cpp\">gv_plex_offset(...., int *sdno, int growing) {   ....   *sdno = stripeno % sdcount;   ....   KASSERT(sdno &gt;= 0, (&quot;gv_plex_offset: sdno &lt; 0&quot;));   .... }<\/code><\/pre>\n<p>  \u041e\u0447\u0435\u043d\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435 \u043c\u0435\u0441\u0442\u043e \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e 503-\u0439 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0438. \u041d\u0435\u0442 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0441\u043c\u044b\u0441\u043b\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c, \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043b\u0438 \u0440\u0430\u0432\u043d\u043e 0. \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0437\u0434\u0435\u0441\u044c \u0437\u0430\u0431\u044b\u043b\u0438 \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u00absdno\u00bb, \u0447\u0442\u043e\u0431\u044b \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0445\u0440\u0430\u043d\u0438\u043c\u043e\u0435 \u0442\u0430\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/p>\n<p>  \u0415\u0449\u0451 \u0434\u0432\u0430 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u0441 \u043d\u0443\u043b\u0451\u043c:<\/p>\n<ul>\n<li>V503 This is a nonsensical comparison: pointer &gt;= 0. geom_vinum_raid5.c 602<\/li>\n<li>V503 This is a nonsensical comparison: pointer &gt;= 0. geom_vinum_raid5.c 610<\/li>\n<\/ul>\n<p>  <a href=\"http:\/\/www.viva64.com\/ru\/d\/0111\/\">V522<\/a> Dereferencing of the null pointer &#8216;sc&#8217; might take place. mrsas.c 4027  <\/p>\n<pre><code class=\"cpp\">void mrsas_aen_handler(struct mrsas_softc *sc) {   ....   if (!sc) {     device_printf(sc-&gt;mrsas_dev, &quot;invalid instance!\\n&quot;);     return;   }   if (sc-&gt;evt_detail_mem) {   .... }<\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u00absc\u00bb \u043d\u0443\u043b\u0435\u0432\u043e\u0439, \u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432\u044b\u0445\u043e\u0434 \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u041d\u043e \u0442\u0443\u0442 \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0437\u0430\u0447\u0435\u043c \u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u043a\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u00absc-&gt;mrsas_dev\u00bb.<\/p>\n<p>  \u0421\u043f\u0438\u0441\u043e\u043a \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0441\u0442:<\/p>\n<ul>\n<li>V522 Dereferencing of the null pointer &#8216;sc&#8217; might take place. mrsas.c 1279<\/li>\n<li>V522 Dereferencing of the null pointer &#8216;sc&#8217; might take place. tws_cam.c 1066<\/li>\n<li>V522 Dereferencing of the null pointer &#8216;sc&#8217; might take place. blkfront.c 677<\/li>\n<li>V522 Dereferencing of the null pointer &#8216;dev_priv&#8217; might take place. radeon_cs.c 153<\/li>\n<li>V522 Dereferencing of the null pointer &#8216;ha&#8217; might take place. ql_isr.c 728<\/li>\n<\/ul>\n<p>  <a href=\"http:\/\/www.viva64.com\/ru\/d\/0354\/\">V713<\/a> The pointer m was utilized in the logical expression before it was verified against nullptr in the same logical expression. ip_fastfwd.c 245  <\/p>\n<pre><code class=\"cpp\">struct mbuf * ip_tryforward(struct mbuf *m) {   ....   if (pfil_run_hooks(       &amp;V_inet_pfil_hook, &amp;m, m-&gt;m_pkthdr.rcvif, PFIL_IN, NULL) ||       m == NULL)     goto drop;   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u00abm == NULL\u00bb \u0441\u0442\u043e\u0438\u0442 \u0432 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u0434\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f, \u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e pfil_run_hooks().<\/p>\n<h2>\u0426\u0438\u043a\u043b\u044b<\/h2>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/9c7\/828\/4dc\/9c78284dc6f20afc9911f7f52ad749c6.png\" \/><\/div>\n<p>  <a href=\"http:\/\/www.viva64.com\/ru\/d\/0238\/\">V621<\/a> Consider inspecting the &#8216;for&#8217; operator. It&#8217;s possible that the loop will be executed incorrectly or won&#8217;t be executed at all. if_ae.c 1663  <\/p>\n<pre><code class=\"cpp\">#define  AE_IDLE_TIMEOUT    100  static void ae_stop_rxmac(ae_softc_t *sc) {   int i;   ....   \/*    * Wait for IDLE state.    *\/   for (i = 0; i &lt; AE_IDLE_TIMEOUT; i--) {  \/\/ &lt;=     val = AE_READ_4(sc, AE_IDLE_REG);     if ((val &amp; (AE_IDLE_RXMAC | AE_IDLE_DMAWRITE)) == 0)       break;     DELAY(100);   }   .... }<\/code><\/pre>\n<p>  \u0412 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043a\u043e\u0434\u0435 FreeBSD \u043d\u0430\u0448\u0451\u043b\u0441\u044f \u0442\u0430\u043a\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u0438 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0446\u0438\u043a\u043b. \u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e \u0437\u0430\u0447\u0435\u043c, \u043d\u043e \u0442\u0443\u0442 \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0434\u0435\u043a\u0440\u0435\u043c\u0435\u043d\u0442 \u0441\u0447\u0451\u0442\u0447\u0438\u043a\u0430 \u0446\u0438\u043a\u043b\u0430, \u0432\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0434\u0435\u043b\u0430\u0442\u044c \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0446\u0438\u043a\u043b \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 AE_IDLE_TIMEOUT, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 &#8216;break&#8217;.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0446\u0438\u043a\u043b \u0432\u043e\u0432\u0440\u0435\u043c\u044f \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d, \u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u043a\u043e\u0432\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 &#8216;i&#8217;. \u041f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u043a\u043e\u0432\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0438\u0447\u0435\u043c \u0438\u043d\u044b\u043c, \u043a\u0430\u043a \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u043c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u041f\u0440\u0438\u0447\u0435\u043c \u044d\u0442\u043e \u043d\u0435 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u0430\u044f \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c, \u0430 \u0432\u043f\u043e\u043b\u043d\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u0430\u044f. \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u043c\u043e\u0439 \u043a\u043e\u043b\u043b\u0435\u0433\u0430 \u043f\u0438\u0441\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u044e \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443: &quot;<a href=\"http:\/\/www.viva64.com\/ru\/b\/0374\/\">Undefined behavior \u0431\u043b\u0438\u0436\u0435, \u0447\u0435\u043c \u0432\u044b \u0434\u0443\u043c\u0430\u0435\u0442\u0435<\/a>&quot;.<\/p>\n<p>  \u0415\u0449\u0451 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442. \u0422\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u0430\u044f \u0436\u0435 \u043e\u0448\u0438\u0431\u043a\u0430 \u0431\u044b\u043b\u0430 <a href=\"http:\/\/www.viva64.com\/ru\/b\/0317\/\">\u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0430<\/a> \u043c\u043d\u043e\u0439 \u0432 \u043a\u043e\u0434\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b Haiku (\u0441\u043c. \u0440\u0430\u0437\u0434\u0435\u043b \u00ab\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f #17, #18\u00bb). \u041d\u0435 \u0437\u043d\u0430\u044e, \u043a\u0442\u043e \u0443 \u043a\u043e\u0433\u043e \u043f\u043e\u0437\u0430\u0438\u043c\u0441\u0442\u0432\u043e\u0432\u0430\u043b \u0444\u0430\u0439\u043b \u00abif_ae.c\u00bb, \u043d\u043e \u043e\u0448\u0438\u0431\u043a\u0430 \u044f\u0432\u043d\u043e \u0440\u0430\u0437\u043c\u043d\u043e\u0436\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c :).<\/p>\n<p>  <a href=\"http:\/\/www.viva64.com\/ru\/d\/0124\/\">V535<\/a> The variable &#8216;i&#8217; is being used for this loop and for the outer loop. Check lines: 182, 183. mfi_tbolt.c 183  <\/p>\n<pre><code class=\"cpp\">mfi_tbolt_adp_reset(struct mfi_softc *sc) {   ....   for (i=0; i &lt; 10; i++) {     for (i = 0; i &lt; 10000; i++);   }   .... }<\/code><\/pre>\n<p>  \u042d\u0442\u043e\u0442 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043a\u043e\u0434 \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0438, \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u043e \u0442\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f 10000 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439, \u0430 \u043d\u0435 10*10000, \u0442\u043e\u0433\u0434\u0430 \u0437\u0430\u0447\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0432\u0430 \u0446\u0438\u043a\u043b\u0430?<\/p>\n<p>  \u042f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u0432\u0435\u043b \u044d\u0442\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440, \u0442.\u043a. \u043e\u043d \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u044b\u043c, \u043a\u043e\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0434\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0432\u043e \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0438 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0446\u0438\u043a\u043b\u0430\u0445 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u044b\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c.<\/p>\n<p>  <a href=\"http:\/\/www.viva64.com\/ru\/d\/0124\/\">V535<\/a> The variable &#8216;i&#8217; is being used for this loop and for the outer loop. Check lines: 197, 208. linux_vdso.c 208  <\/p>\n<pre><code class=\"cpp\">void __elfN(linux_vdso_reloc)(struct sysentvec *sv, long vdso_adjust) {   ....   for(i = 0; i &lt; ehdr-&gt;e_shnum; i++) {                      \/\/ &lt;=     if (!(shdr[i].sh_flags &amp; SHF_ALLOC))       continue;     shdr[i].sh_addr += vdso_adjust;     if (shdr[i].sh_type != SHT_SYMTAB &amp;&amp;         shdr[i].sh_type != SHT_DYNSYM)       continue;      sym = (Elf_Sym *)((caddr_t)ehdr + shdr[i].sh_offset);     symcnt = shdr[i].sh_size \/ sizeof(*sym);      for(i = 0; i &lt; symcnt; i++, sym++) {                    \/\/ &lt;=       if (sym-&gt;st_shndx == SHN_UNDEF ||           sym-&gt;st_shndx == SHN_ABS)         continue;       sym-&gt;st_value += vdso_adjust;     }   }   .... }<\/code><\/pre>\n<p>  \u0410 \u044d\u0442\u043e \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043b\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u0434. \u041d\u043e \u043f\u043e \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c\u0443 \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434, \u0447\u0442\u043e \u0442\u0443\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0442\u043e\u0436\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u0432\u0435\u0440\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439.<\/p>\n<p>  <a href=\"http:\/\/www.viva64.com\/ru\/d\/0137\/\">V547<\/a> Expression &#8216;j &gt;= 0&#8217; is always true. Unsigned type value is always &gt;= 0. safe.c 1596  <\/p>\n<pre><code class=\"cpp\">static void safe_mcopy(struct mbuf *srcm, struct mbuf *dstm, u_int offset) {   u_int j, dlen, slen;                   \/\/ &lt;=   caddr_t dptr, sptr;    \/*    * Advance src and dst to offset.    *\/   j = offset;   while (j &gt;= 0) {                       \/\/ &lt;=     if (srcm-&gt;m_len &gt; j)       break;     j -= srcm-&gt;m_len;                    \/\/ &lt;=     srcm = srcm-&gt;m_next;     if (srcm == NULL)       return;   }   sptr = mtod(srcm, caddr_t) + j;   slen = srcm-&gt;m_len - j;    j = offset;   while (j &gt;= 0) {                       \/\/ &lt;=     if (dstm-&gt;m_len &gt; j)       break;     j -= dstm-&gt;m_len;                    \/\/ &lt;=     dstm = dstm-&gt;m_next;     if (dstm == NULL)       return;   }   dptr = mtod(dstm, caddr_t) + j;   dlen = dstm-&gt;m_len - j;   .... }<\/code><\/pre>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0434\u0432\u0430 \u043e\u043f\u0430\u0441\u043d\u044b\u0445 \u0446\u0438\u043a\u043b\u0430. \u0422.\u043a. \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f &#8216;j&#8217; (\u0441\u0447\u0451\u0442\u0447\u0438\u043a\u0438 \u0446\u0438\u043a\u043b\u043e\u0432) \u0438\u043c\u0435\u0435\u0442 \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u0442\u0438\u043f, \u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u00abj &gt;= 0\u00bb \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u0441\u0442\u0438\u043d\u043d\u0430 \u0438 \u0446\u0438\u043a\u043b\u044b \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u00ab\u0432\u0435\u0447\u043d\u044b\u043c\u0438\u00bb. \u0414\u0440\u0443\u0433\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0441\u0447\u0451\u0442\u0447\u0438\u043a\u0430 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0432\u044b\u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0435\u0441\u043b\u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u043f\u0440\u0435\u043e\u0434\u043e\u043b\u0435\u0442\u044c \u043d\u0443\u043b\u0435\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f &#8216;j&#8217; \u043f\u0440\u0438\u043c\u0435\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430.<\/p>\n<p>  <a href=\"http:\/\/www.viva64.com\/ru\/d\/0352\/\">V711<\/a> It is dangerous to create a local variable within a loop with a same name as a variable controlling this loop. powernow.c 733  <\/p>\n<pre><code class=\"cpp\">static int pn_decode_pst(device_t dev) {   ....   struct pst_header *pst;                                   \/\/ &lt;=   ....   p = ((uint8_t *) psb) + sizeof(struct psb_header);   pst = (struct pst_header*) p;    maxpst = 200;    do {     struct pst_header *pst = (struct pst_header*) p;        \/\/ &lt;=      ....      p += sizeof(struct pst_header) + (2 * pst-&gt;numpstates);   } while (cpuid_is_k7(pst-&gt;cpuid) &amp;&amp; maxpst--);            \/\/ &lt;=   .... }<\/code><\/pre>\n<p>  \u0412 \u0442\u0435\u043b\u0435 \u0446\u0438\u043a\u043b\u0430 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043e \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439, \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0449\u0435\u0439 \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 \u0434\u043b\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0446\u0438\u043a\u043b\u0430. \u0423 \u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u043f\u043e\u0434\u043e\u0437\u0440\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u0438\u0437-\u0437\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u0441 \u0442\u0430\u043a\u0438\u043c \u0436\u0435 \u0438\u043c\u0435\u043d\u0435\u043c &#8216;pst&#8217;, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u0441 \u0438\u043c\u0435\u043d\u0435\u043c &#8216;pst&#8217; \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432 \u0443\u0441\u043b\u043e\u0432\u0438\u0438 \u0446\u0438\u043a\u043b\u0430 do&#8230;.while() \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u043e \u0438 \u0442\u043e\u0436\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u00abpst-&gt;cupid\u00bb. \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0435\u0440\u0435\u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u044d\u0442\u043e \u043c\u0435\u0441\u0442\u043e \u0438 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0438\u043c\u0435\u043d\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c.<\/p>\n<h2>\u0420\u0430\u0437\u043d\u043e\u0435<\/h2>\n<p>  <a href=\"http:\/\/www.viva64.com\/ru\/d\/0164\/\">V569<\/a> Truncation of constant value -96. The value range of unsigned char type: [0, 255]. if_rsu.c 1516  <\/p>\n<pre><code class=\"cpp\">struct ieee80211_rx_stats {   ....   uint8_t nf;      \/* global NF *\/   uint8_t rssi;    \/* global RSSI *\/   .... };  static void rsu_event_survey(struct rsu_softc *sc, uint8_t *buf, int len) {   ....   rxs.rssi = le32toh(bss-&gt;rssi) \/ 2;   rxs.nf = -96;   .... }<\/code><\/pre>\n<p>  \u041e\u0447\u0435\u043d\u044c \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u0447\u0442\u043e \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u00abrxs.nf\u00bb \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 &#8216;-96&#8217;. \u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 &#8216;160&#8217;.<\/p>\n<p>  <a href=\"http:\/\/www.viva64.com\/ru\/d\/0376\/\">V729<\/a> Function body contains the &#8216;done&#8217; label that is not used by any &#8216;goto&#8217; statements. zfs_acl.c 2023  <\/p>\n<pre><code class=\"cpp\">int zfs_setacl(znode_t *zp, vsecattr_t *vsecp, ....) {   .... top:   mutex_enter(&amp;zp-&gt;z_acl_lock);   mutex_enter(&amp;zp-&gt;z_lock);   ....   if (error == ERESTART) {     dmu_tx_wait(tx);     dmu_tx_abort(tx);     goto top;   }   .... done:                            \/\/ &lt;=   mutex_exit(&amp;zp-&gt;z_lock);   mutex_exit(&amp;zp-&gt;z_acl_lock);    return (error); }<\/code><\/pre>\n<p>  \u0412 \u043a\u043e\u0434\u0435 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u043c\u0435\u0442\u043a\u0438, \u043d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u044b\u0437\u043e\u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 &#8216;goto&#8217; \u0434\u043b\u044f \u044d\u0442\u0438\u0445 \u043c\u0435\u0442\u043e\u043a \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u043a\u043e\u0434\u0430 \u043c\u0435\u0442\u043a\u0430 &#8216;top&#8217; \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f, \u0430 \u0432\u043e\u0442 &#8216;done&#8217; \u043d\u0438\u0433\u0434\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043d\u0430 \u043c\u0435\u0442\u043a\u0443 \u0437\u0430\u0431\u044b\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438\u043b\u0438 \u0441\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u0443\u0434\u0430\u043b\u0438\u043b\u0438, \u0430 \u043c\u0435\u0442\u043a\u0443 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438.<\/p>\n<p>  <a href=\"http:\/\/www.viva64.com\/ru\/d\/0265\/\">V646<\/a> Consider inspecting the application&#8217;s logic. It&#8217;s possible that &#8216;else&#8217; keyword is missing. mac_process.c 352  <\/p>\n<pre><code class=\"cpp\">static void mac_proc_vm_revoke_recurse(struct thread *td, struct ucred *cred,     struct vm_map *map) {   ....   if (!mac_mmap_revocation_via_cow) {     vme-&gt;max_protection &amp;= ~VM_PROT_WRITE;     vme-&gt;protection &amp;= ~VM_PROT_WRITE;   } if ((revokeperms &amp; VM_PROT_READ) == 0)   \/\/ &lt;=     vme-&gt;eflags |= MAP_ENTRY_COW |         MAP_ENTRY_NEEDS_COPY;   .... }<\/code><\/pre>\n<p>  \u041d\u0430\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u043a \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0440\u043e \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0443\u0436\u0435 \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0432 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u0417\u0434\u0435\u0441\u044c \u043a\u043e\u0434 \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 &#8216;else&#8217; \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c.<\/p>\n<p>  <a href=\"http:\/\/www.viva64.com\/ru\/d\/0344\/\">V705<\/a> It is possible that &#8216;else&#8217; block was forgotten or commented out, thus altering the program&#8217;s operation logics. scsi_da.c 3231  <\/p>\n<pre><code class=\"cpp\">static void dadone(struct cam_periph *periph, union ccb *done_ccb) {   ....   \/*    * If we tried READ CAPACITY(16) and failed,    * fallback to READ CAPACITY(10).    *\/   if ((state == DA_CCB_PROBE_RC16) &amp;&amp;     ....   } else                                                    \/\/ &lt;=   \/*    * Attach to anything that claims to be a    * direct access or optical disk device,    * as long as it doesn't return a &quot;Logical    * unit not supported&quot; (0x25) error.    *\/   if ((have_sense) &amp;&amp; (asc != 0x25)                         \/\/ &lt;=     ....   } else {      ....   }   .... }<\/code><\/pre>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u043a\u043e\u0434\u0435 \u0435\u0449\u0451 \u043d\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0438, \u043d\u043e \u043a\u043e\u0433\u0434\u0430-\u043d\u0438\u0431\u0443\u0434\u044c \u043e\u043d\u0430 \u0442\u043e\u0447\u043d\u043e \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f. \u041e\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0442\u0430\u043a\u043e\u0439 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u043f\u0435\u0440\u0435\u0434 &#8216;else&#8217;, \u043c\u043e\u0436\u043d\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0437\u0430\u0431\u044b\u0442\u044c, \u0447\u0442\u043e \u0433\u0434\u0435-\u0442\u043e \u0442\u0430\u043c \u0431\u044b\u043b\u043e \u044d\u0442\u043e \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e, \u0438 \u043d\u0435\u043e\u0441\u043e\u0437\u043d\u0430\u043d\u043d\u043e \u0432\u043d\u0435\u0441\u0442\u0438 \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u0443\u044e \u043f\u0440\u0430\u0432\u043a\u0443 \u0432 \u043a\u043e\u0434 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c.<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/be7\/0f3\/df8\/be70f3df8fe8399dcbfc73bc10b2a695.png\" \/><\/div>\n<p>  \u041f\u0440\u043e\u0435\u043a\u0442 FreeBSD \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 PVS-Studio, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0430 \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442! \u0412\u0435\u0441\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0443\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 \u043e\u0434\u043d\u043e\u0439 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 FreeBSD \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430 \u0432\u0435\u0441\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0442\u043e\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435.<\/p>\n<p>  \u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0432\u0441\u0435\u043c \u0436\u0435\u043b\u0430\u044e\u0449\u0438\u043c \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c <a href=\"http:\/\/www.viva64.com\/ru\/pvs-studio\/\">PVS-Studio<\/a> \u043d\u0430 \u0441\u0432\u043e\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445. \u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0441\u0440\u0435\u0434\u0435 Windows. \u0414\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0434\u043b\u044f Linux\/FreeBSD \u0443 \u043d\u0430\u0441 \u043d\u0435\u0442 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438. \u041d\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0431\u0441\u0443\u0434\u0438\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u043f\u043e \u0430\u0434\u0430\u043f\u0442\u0430\u0446\u0438\u0438 PVS-Studio \u0434\u043b\u044f \u0432\u0430\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0438 \u0437\u0430\u0434\u0430\u0447.<\/p>\n<p>  <a href=\"http:\/\/www.viva64.com\/en\/b\/0377\/\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/35e\/064\/ddf\/35e064ddf91f5d99b620384893909ff7.png\" \/><\/div>\n<p><\/a><br \/>  \u0415\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435\u0439 \u0441 \u0430\u043d\u0433\u043b\u043e\u044f\u0437\u044b\u0447\u043d\u043e\u0439 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0435\u0439, \u0442\u043e \u043f\u0440\u043e\u0448\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043f\u0435\u0440\u0435\u0432\u043e\u0434: Svyatoslav Razmyslov. <a href=\"http:\/\/www.viva64.com\/en\/b\/0377\/\">PVS-Studio delved into the FreeBSD kernel<\/a>.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u043b\u0438 \u0441\u0442\u0430\u0442\u044c\u044e \u0438 \u0435\u0441\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441?<\/b><\/p>\n<div class=\"spoiler_text\">\u0427\u0430\u0441\u0442\u043e \u043a \u043d\u0430\u0448\u0438\u043c \u0441\u0442\u0430\u0442\u044c\u044f\u043c \u0437\u0430\u0434\u0430\u044e\u0442 \u043e\u0434\u043d\u0438 \u0438 \u0442\u0435 \u0436\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b. \u041e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u043d\u0438\u0445 \u043c\u044b \u0441\u043e\u0431\u0440\u0430\u043b\u0438 \u0437\u0434\u0435\u0441\u044c: <a href=\"http:\/\/www.viva64.com\/ru\/a\/0085\/\">\u041e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439 \u0441\u0442\u0430\u0442\u0435\u0439 \u043f\u0440\u043e PVS-Studio, \u0432\u0435\u0440\u0441\u0438\u044f 2015<\/a>. \u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c.  <\/div>\n<\/div>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habrahabr.ru\/post\/277439\/\"> https:\/\/habrahabr.ru\/post\/277439\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/559\/511\/580\/559511580dacd6797ab8cb144e60cb88.png\" align=\"left\"\/>\u041e\u043a\u043e\u043b\u043e \u0433\u043e\u0434\u0430 \u043d\u0430\u0437\u0430\u0434 \u043c\u044b \u0441\u043c\u043e\u0433\u043b\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u044f\u0434\u0440\u043e Linux. \u042d\u0442\u043e \u0431\u044b\u043b\u0430 \u043e\u0434\u043d\u0430 \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u0435\u043c\u044b\u0445 \u0441\u0442\u0430\u0442\u0435\u0439 \u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 open-source \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0437\u0430 \u0432\u0441\u0451 \u0432\u0440\u0435\u043c\u044f. \u041f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0438 \u043d\u0430 FreeBSD \u0442\u043e\u0433\u0434\u0430 \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u043b\u0438, \u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c.   <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-274483","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/274483","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=274483"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/274483\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=274483"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=274483"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=274483"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}