{"id":284524,"date":"2017-04-06T12:10:02","date_gmt":"2017-04-06T08:10:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=284524"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=284524","title":{"rendered":"\u041a\u0430\u043a \u043d\u0430\u0439\u0442\u0438 56 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0432 \u043a\u043e\u0434\u0435 FreeBSD \u0437\u0430 \u043e\u0434\u0438\u043d \u0432\u0435\u0447\u0435\u0440"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/5b6\/5d4\/195\/5b65d4195da88c1044587655b7c725d9.png\" alt=\"FreeBSD, CWE\"\/><br \/>  \u041f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u043d\u043e\u0432\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 FreeBSD \u0438 \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u0434\u0430\u0436\u0435 \u0432 \u0442\u0430\u043a\u0438\u0445 \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u044b\u0445 \u0438 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 PVS-Studio \u043b\u0435\u0433\u043a\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u043e\u0448\u0438\u0431\u043a\u0438. \u0412 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u044f \u0440\u0435\u0448\u0438\u043b \u0432\u0437\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u043d\u0430 \u043f\u043e\u0438\u0441\u043a \u043e\u0448\u0438\u0431\u043e\u043a \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0435\u0439. \u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 PVS-Studio \u0432\u0441\u0435\u0433\u0434\u0430 \u0443\u043c\u0435\u043b \u0432\u044b\u044f\u0432\u043b\u044f\u0442\u044c \u0434\u0435\u0444\u0435\u043a\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0430\u0442\u0430\u043a\u0438. \u041d\u043e \u043c\u044b \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0430\u043a\u0446\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u043d\u0430 \u044d\u0442\u043e\u043c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0438 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u043a\u0430\u043a \u043e\u043f\u0435\u0447\u0430\u0442\u043a\u0438, \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u044f \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u043e\u0433\u043e Copy-Paste \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435, \u0438 \u043d\u0435 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0438\u0445, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e CWE. \u0421\u0435\u0439\u0447\u0430\u0441 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u0438 \u043e \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438, \u0438 \u043e\u0431 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044f\u0445, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u044e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0432\u0430\u0448\u0435 \u0432\u043e\u0441\u043f\u0440\u0438\u044f\u0442\u0438\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430. PVS-Studio \u2014 \u044d\u0442\u043e \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0438\u0441\u043a \u0431\u0430\u0433\u043e\u0432, \u043d\u043e \u0435\u0449\u0451 \u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u043f\u043e\u0432\u044b\u0448\u0430\u044e\u0449\u0438\u0439 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0434\u0430.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u041e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435<\/h2>\n<p>  <i>\u041e\u0442\u0447\u0435\u0442 \u043e \u043d\u0430\u0448\u0435\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 FreeBSD \u0432 2016 \u0433\u043e\u0434\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/www.viva64.com\/ru\/b\/0377\/\"><i>\u0437\u0434\u0435\u0441\u044c<\/i><\/a>.<\/i><\/p>\n<p>  \u041a\u0430\u043a \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0437 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f, \u0442\u043e, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432 \u0441\u0442\u0430\u0442\u044c\u0435, \u044f \u043d\u0430\u0448\u0435\u043b \u0437\u0430 \u043e\u0434\u0438\u043d \u0432\u0435\u0447\u0435\u0440. \u0422.\u0435. \u043d\u0430 \u043f\u043e\u0438\u0441\u043a \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u044f \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u043b \u0432\u0441\u0435\u0433\u043e 2-3 \u0447\u0430\u0441\u0430. \u042d\u0442\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043e \u0432\u0441\u0435\u0439 \u043c\u043e\u0449\u0438 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 <a href=\"https:\/\/www.viva64.com\/ru\/pvs-studio\/\">PVS-Studio<\/a>. \u042f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0448 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0432\u0441\u0435\u043c, \u043a\u043e\u0433\u043e \u0437\u0430\u0431\u043e\u0442\u0438\u0442 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u0434\u0430, \u0430 \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u0435\u0433\u043e \u043d\u0430\u0434\u0451\u0436\u043d\u043e\u0441\u0442\u044c \u0438 \u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0441\u0442\u044c \u043a \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c \u0430\u0442\u0430\u043a\u0430\u043c.<\/p>\n<p>  \u0412\u044b\u043f\u0438\u0441\u0430\u043b \u043a\u043e\u0434 \u0441 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438 \u044f \u0431\u044b\u0441\u0442\u0440\u043e, \u0430 \u0432\u043e\u0442 \u043d\u0430\u0439\u0442\u0438 \u0432\u0440\u0435\u043c\u044f \u043e\u0444\u043e\u0440\u043c\u0438\u0442\u044c \u0441\u0432\u043e\u0438 \u0438\u0437\u044b\u0441\u043a\u0430\u043d\u0438\u044f \u0432 \u0432\u0438\u0434\u0435 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u044f \u043d\u0435 \u043c\u043e\u0433 \u0442\u0440\u0438 \u043d\u0435\u0434\u0435\u043b\u0438. \u0417\u0430 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043c\u044b \u0434\u0430\u0436\u0435 \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u043b\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u043e\u0448\u0438\u0431\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0432 \u0441\u0442\u0430\u0442\u044c\u0435, \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043d\u043e\u0432\u043e\u0433\u043e \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u00ab\u0414\u0435\u0444\u0435\u043a\u0442\u044b \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0441\u0442\u0440\u0430\u043d\u0438\u043b\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 PVS-Studio \u043d\u0430 \u044d\u0442\u043e\u0439 \u043d\u0435\u0434\u0435\u043b\u0435\u00bb: <a href=\"https:\/\/www.viva64.com\/ru\/b\/0487\/\">\u0432\u044b\u043f\u0443\u0441\u043a N2<\/a>, <a href=\"https:\/\/www.viva64.com\/ru\/b\/0491\/\">\u0432\u044b\u043f\u0443\u0441\u043a N3<\/a>.<\/p>\n<p>  \u041f\u0440\u0430\u0432\u0438\u043b\u0438 \u043c\u044b \u0442\u043e, \u0447\u0442\u043e \u043f\u043e\u043f\u0440\u043e\u0449\u0435 \u0438 \u0433\u0434\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043a\u0430\u043a \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u0442\u044c, \u043d\u0435 \u0432\u0434\u0430\u0432\u0430\u044f\u0441\u044c \u0432 \u0441\u0443\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0430\u0432\u0442\u043e\u0440\u0430\u043c FreeBSD \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u0448\u0438\u043c\u0438 \u043f\u0440\u0430\u0432\u043a\u0430\u043c\u0438 \u0438 \u0434\u0430\u0436\u0435 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435\u0439, \u0430 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0430\u043d\u0430\u043b\u0438\u0437 \u043a\u043e\u0434\u0430 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0438 \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e. \u042f \u0433\u043e\u0442\u043e\u0432 \u0432\u044b\u0434\u0430\u0442\u044c \u0438\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u0434\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043c\u043e\u0447\u044c \u0432 \u0431\u043e\u0440\u044c\u0431\u0435 \u0441 \u043b\u043e\u0436\u043d\u044b\u043c\u0438 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u044f\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0438\u043c \u043c\u0435\u0448\u0430\u0442\u044c. \u041a\u0441\u0442\u0430\u0442\u0438, \u043e \u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u044f\u0445\u2026<\/p>\n<h2>\u041b\u043e\u0436\u043d\u044b\u0435 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u044f<\/h2>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e PVS-Studio, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0440\u0430\u0437\u0431\u0440\u043e\u0441 \u043f\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0439. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u044b \u043d\u0435\u0434\u0430\u0432\u043d\u043e <a href=\"https:\/\/www.viva64.com\/ru\/b\/0478\/\">\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b\u0438 \u043f\u0440\u043e\u0435\u043a\u0442 FAR<\/a>, \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0439 \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u043e 50%. \u042d\u0442\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0449\u0438\u0439, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u043e\u0435 \u0432\u0442\u043e\u0440\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u043e\u0448\u0438\u0431\u043a\u0443 \u0438\u043b\u0438 \u043a\u0440\u0430\u0439\u043d\u0435 \u043f\u043b\u043e\u0445\u043e\u0439 \u043a\u043e\u0434. \u0410 \u043f\u0440\u0438 <a href=\"https:\/\/www.viva64.com\/ru\/b\/0481\/\">\u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 Media Portal 2<\/a> \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u044b\u043b \u0435\u0449\u0451 \u043b\u0443\u0447\u0448\u0435: 27% \u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0439.<\/p>\n<p>  \u0421 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c FreeBSD \u0432\u0441\u0451 \u0441\u043b\u043e\u0436\u043d\u0435\u0435. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0432\u044b\u0434\u0430\u043b \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439 \u043e\u0431\u0449\u0435\u0433\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>3577 \u0443\u0440\u043e\u0432\u043d\u044f High<\/li>\n<li>2702 \u0443\u0440\u043e\u0432\u043d\u044f Medium<\/li>\n<\/ul>\n<p>  \u0411\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043b\u043e\u0436\u043d\u044b\u043c\u0438 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u044f\u043c\u0438. \u041f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u043e, \u043d\u043e \u0434\u0443\u043c\u0430\u044e, \u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u043a\u043e\u043b\u043e 95%.<\/p>\n<p>  \u041e \u0447\u0435\u043c \u044d\u0442\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442? \u042d\u0442\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442, \u0447\u0442\u043e \u043d\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430 \u0440\u0430\u0441\u0441\u0443\u0436\u0434\u0430\u0442\u044c \u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0439 \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445, \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0434\u044f \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430. \u0411\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043b\u043e\u0436\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0438\u0437-\u0437\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u043c\u0430\u043a\u0440\u043e\u0441\u043e\u0432 \u0438 \u0438\u0445 \u043b\u0435\u0433\u043a\u043e \u0443\u0431\u0440\u0430\u0442\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b, \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u044b\u0435 \u0432 PVS-Studio. \u041f\u043e\u044f\u0441\u043d\u044e \u044d\u0442\u043e \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435.<\/p>\n<p>  \u0412 \u043a\u043e\u0434\u0435 FreeBSD \u043c\u043e\u0436\u043d\u043e \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432:  <\/p>\n<pre><code class=\"cpp\">#ifdef Q #undef Q #endif #define Q(_r) \\   (((_r) == 1.5) ? 0 : (((_r) ==2.25) ? 1 : (((_r) == 3) ? 2 : \\   (((_r) == 4.5) ? 3 : (((_r) ==  6)  ? 4 : (((_r) == 9) ? 5 : \\   (((_r) == 12)  ? 6 : (((_r) == 13.5)? 7 : 0)))))))) static const struct txschedule series_quarter[] = {   { 3,Q( 1.5),3,Q(1.5), 0,Q(1.5), 0,Q(1.5) },  \/* 1.5Mb\/s *\/   { 4,Q(2.25),3,Q(1.5), 4,Q(1.5), 0,Q(1.5) },  \/*2.25Mb\/s *\/   { 4,Q(   3),3,Q(1.5), 4,Q(1.5), 0,Q(1.5) },  \/*   3Mb\/s *\/   { 4,Q( 4.5),3,Q(  3), 4,Q(1.5), 2,Q(1.5) },  \/* 4.5Mb\/s *\/   { 4,Q(   6),3,Q(4.5), 4,Q(  3), 2,Q(1.5) },  \/*   6Mb\/s *\/   { 4,Q(   9),3,Q(  6), 4,Q(4.5), 2,Q(1.5) },  \/*   9Mb\/s *\/   { 4,Q(  12),3,Q(  9), 4,Q(  6), 2,Q(  3) },  \/*  12Mb\/s *\/   { 4,Q(13.5),3,Q( 12), 4,Q(  9), 2,Q(  6) }  \/*13.5Mb\/s *\/ }; #undef Q<\/code><\/pre>\n<p>  \u041c\u0430\u043a\u0440\u043e\u0441 Q(1.5) \u0440\u0430\u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432:  <\/p>\n<pre><code class=\"cpp\">(((1.5) == 1.5) ? 0 : (((1.5) ==2.25) ? 1 : (((1.5) == 3) ? 2 : \\ (((1.5) == 4.5) ? 3 : (((1.5) ==  6)  ? 4 : (((1.5) == 9) ? 5 : \\ (((1.5) == 12)  ? 6 : (((1.5) == 13.5)? 7 : 0))))))))<\/code><\/pre>\n<p>  \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 PVS-Studio \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 (((1.5) == 3) \u043e\u043d \u0432\u044b\u0434\u0430\u0451\u0442 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435:<\/p>\n<p>  <a href=\"http:\/\/www.viva64.com\/ru\/w\/V674\/\">V674<\/a> The &#8216;1.5&#8217; literal of the &#8216;double&#8217; type is compared to a value of the &#8216;int&#8217; type. Consider inspecting the &#8216;(1.5) == 3&#8217; expression. tx_schedules.h 228<\/p>\n<p>  \u0412\u0441\u0435\u0433\u043e \u043d\u0430 \u044d\u0442\u043e\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0432\u044b\u0434\u0430\u0451\u0442 <b>96 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439<\/b>.<\/p>\n<p>  \u0412 \u043a\u043e\u0434\u0435 FreeBSD \u043c\u043e\u0436\u043d\u043e \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442\u044c \u0435\u0449\u0451 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0430\u043a\u0438\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432. \u0421\u0443\u043c\u043c\u0430\u0440\u043d\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0432\u044b\u0434\u0430\u0451\u0442 \u043d\u0430 \u043d\u0438\u0445 692 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u0443\u0440\u043e\u0432\u043d\u044f High. \u041d\u0430\u043f\u043e\u043c\u043d\u044e, \u0447\u0442\u043e \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439 \u0443\u0440\u043e\u0432\u043d\u044f High \u043d\u0430\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f 3577. \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0442\u0430\u043a\u0438\u0435 \u043c\u0430\u043a\u0440\u043e\u0441\u044b \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0442 \u043a \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044e 1\/5 \u044d\u0442\u0438\u0445 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439.<\/p>\n<p>  \u0414\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u0447\u0443\u0442\u044c-\u0447\u0443\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0432 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440, \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u0442\u0440\u0430\u043d\u0438\u0442\u044c 20% \u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0443\u0440\u043e\u0432\u043d\u044f High. \u0421\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443, \u043d\u043e, \u043f\u043e\u0436\u0430\u043b\u0443\u0439, \u043f\u0440\u043e\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 <a href=\"http:\/\/www.viva64.com\/ru\/w\/V674\/\">V674<\/a> \u0434\u043b\u044f \u0442\u0435\u0445 \u0444\u0430\u0439\u043b\u043e\u0432, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u044b. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0433\u0434\u0435-\u0442\u043e \u0432 \u0444\u0430\u0439\u043b\u0435 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \/\/-V::674.<\/p>\n<p>  \u042f \u0443\u0436\u0435 \u043e\u0437\u0432\u0443\u0447\u0438\u0432\u0430\u043b \u0432\u0430\u0436\u043d\u0443\u044e \u043c\u044b\u0441\u043b\u044c, \u043d\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u044e \u0435\u0451, \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0430\u0441 \u0432\u043d\u043e\u0432\u044c \u0438 \u0432\u043d\u043e\u0432\u044c \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u044e\u0442 \u043e \u0441\u0440\u0435\u0434\u043d\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0435 \u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0439. \u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043c\u044b \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u044d\u0442\u043e\u0442 \u0441\u0440\u0435\u0434\u043d\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u043d\u0442 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043c\u043d\u043e\u0433\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432, \u043e\u043d \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0446\u0435\u043d\u043d\u043e\u0441\u0442\u0438. \u042d\u0442\u043e \u0442\u043e\u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u043a\u0430\u043a \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u0440\u0435\u0434\u043d\u0435\u0439 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u043e\u0439 \u043f\u043e \u0431\u043e\u043b\u044c\u043d\u0438\u0446\u0435.<\/p>\n<p>  \u0412\u0441\u0435 \u043e\u0447\u0435\u043d\u044c \u0441\u0438\u043b\u044c\u043d\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u041a\u043e\u043c\u0443-\u0442\u043e \u043f\u043e\u0432\u0435\u0437\u0451\u0442 \u0438 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439, \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u044f. \u0414\u0440\u0443\u0433\u0438\u043c \u043d\u0435 \u043f\u043e\u0432\u0435\u0437\u0451\u0442, \u043a\u0430\u043a \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c FreeBSD. \u041f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u043e\u0439 \u0438 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u043e\u0439 \u043c\u0430\u043a\u0440\u043e\u0441\u043e\u0432. \u041d\u043e \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a \u0441\u0442\u0440\u0430\u0448\u043d\u043e, \u043a\u0430\u043a \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434. \u0412\u044b\u0448\u0435 \u044f \u043a\u0430\u043a \u0440\u0430\u0437 \u043f\u043e\u043a\u0430\u0437\u0430\u043b, \u043a\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0441\u0440\u0430\u0437\u0443 \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u0442\u0440\u0430\u043d\u0438\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u043b\u043e\u0436\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439. \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0438 \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f\u043c\u0438, \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0449\u0438\u043c\u0438 \u0438\u0437-\u0437\u0430 \u0434\u0443\u0440\u0430\u0446\u043a\u0438\u0445 \u043c\u0430\u043a\u0440\u043e\u0441\u043e\u0432.<\/p>\n<p>  \u0414\u0430 \u0438 \u0432\u043e\u043e\u0431\u0449\u0435, \u0435\u0441\u043b\u0438 \u0431\u044b \u0441 \u0448\u0443\u043c\u043e\u043c \u0431\u044b\u043b\u043e \u0441\u043b\u043e\u0436\u043d\u043e \u0431\u043e\u0440\u043e\u0442\u044c\u0441\u044f, \u044f \u0431\u044b \u043d\u0435 \u0441\u043c\u043e\u0433 \u043d\u0430\u0439\u0442\u0438 \u0432\u0441\u0435 \u044d\u0442\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u0434\u043b\u044f \u0441\u0442\u0430\u0442\u044c\u0438 \u0437\u0430 \u043e\u0434\u0438\u043d \u0432\u0435\u0447\u0435\u0440.<\/p>\n<h2>\u041d\u043e\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u043d\u0430 \u043c\u0438\u0440<\/h2>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/c51\/a66\/713\/c51a66713cb446cfa41216ad73f7d45b.png\" alt=\"\u0428\u0438\u0440\u043e\u043a\u0438\u0439 \u043a\u0440\u0443\u0433\u043e\u0437\u043e\u0440\"\/><\/p>\n<p>  \u041c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u043c\u0438\u0440 \u0431\u043e\u043b\u0435\u0435 \u0448\u0438\u0440\u043e\u043a\u043e. \u0422\u0430\u043c, \u0433\u0434\u0435 \u0440\u0430\u043d\u044c\u0448\u0435 \u043c\u044b \u0432\u0438\u0434\u0435\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 \u043a\u043e\u0434 \u0441 \u0437\u0430\u043f\u0430\u0445\u043e\u043c, \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0441\u0442\u0430\u0440\u0430\u0435\u043c\u0441\u044f \u0432\u0438\u0434\u0435\u0442\u044c \u0435\u0449\u0451 \u0438 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u043d\u0430\u0447\u0430\u0442\u044c \u0441 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u043c \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f, \u0432\u044b\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e PVS-Studio \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e Common Weakness Enumeration (CWE). \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0437\u0434\u0435\u0441\u044c: <a href=\"https:\/\/www.viva64.com\/ru\/b\/0486\/\">PVS-Studio: \u043f\u043e\u0438\u0441\u043a \u0434\u0435\u0444\u0435\u043a\u0442\u043e\u0432 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438<\/a>.<\/p>\n<p>  \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u0430\u043b\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043e\u0448\u0438\u0431\u043e\u043a \u043c\u043e\u0436\u043d\u043e \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0414\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u0438\u0435 \u0438\u0437 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0445 CWE \u043e\u0448\u0438\u0431\u043e\u043a \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u0432 <a href=\"https:\/\/cve.mitre.org\/\">CVE<\/a>. \u041e\u0434\u043d\u0430\u043a\u043e, \u0447\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0448\u0438\u0431\u043e\u043a, \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u0445 \u043f\u043e\u0434 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e CWE, \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0439\u0434\u0435\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430, \u0442\u0435\u043c \u043b\u0443\u0447\u0448\u0435.<\/p>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 PVS-Studio \u0434\u043b\u044f \u043f\u0440\u043e\u0444\u0438\u043b\u0430\u043a\u0442\u0438\u043a\u0438 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0435\u0439. \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442, \u0447\u0442\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0445\u043e\u0440\u043e\u0448\u043e \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439.<\/p>\n<h2>\u041f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0438<\/h2>\n<p>  <\/p>\n<h3>CWE-476: NULL Pointer Dereference<\/h3>\n<p>  \u0412\u0441\u0435\u0433\u043e \u044f \u0437\u0430\u043c\u0435\u0442\u0438\u043b 22 \u043e\u0448\u0438\u0431\u043a\u0438 \u044d\u0442\u043e\u0433\u043e \u0442\u0438\u043f\u0430. \u0418, \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u0435\u0449\u0451 \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0436\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u043b.<\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0447\u043d\u0435\u043c \u0441 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f.  <\/p>\n<pre><code class=\"cpp\">void ql_mbx_isr(void *arg) {   ....   ha = arg;   if (ha == NULL) {     device_printf(ha-&gt;pci_dev, &quot;%s: arg == NULL\\n&quot;, __func__);     return;   }   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"http:\/\/www.viva64.com\/ru\/w\/V522\/\">V522<\/a> Dereferencing of the null pointer &#8216;ha&#8217; might take place. ql_isr.c 750<\/p>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043e\u0448\u0438\u0431\u043a\u0430 \u0432\u0438\u0434\u043d\u0430 \u0441\u0440\u0430\u0437\u0443. \u0415\u0441\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c <i>ha <\/i> \u0440\u0430\u0432\u0435\u043d <i>NULL<\/i>, \u0442\u043e \u043e\u043d \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0438 <i>ha-&gt;pci_dev<\/i>.<\/p>\n<p>  \u0422\u0430\u043a\u0430\u044f \u0436\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0435\u0449\u0451 \u0432 \u0442\u0440\u0451\u0445 \u0444\u0430\u0439\u043b\u0430\u0445:<\/p>\n<ul>\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;ni&#8217; might take place. ieee80211_hwmp.c 1925<\/li>\n<li>V522 Dereferencing of the null pointer &#8216;sbp&#8217; might take place. sbp.c 2337<\/li>\n<\/ul>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u0443\u044e \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e:  <\/p>\n<pre><code class=\"cpp\">static int ecore_ilt_client_mem_op(struct bxe_softc *sc,                                    int cli_num, uint8_t memop) {   int i, rc;   struct ecore_ilt *ilt = SC_ILT(sc);   struct ilt_client_info *ilt_cli = &amp;ilt-&gt;clients[cli_num];    if (!ilt || !ilt-&gt;lines)     return -1;   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"http:\/\/www.viva64.com\/ru\/w\/V595\/\">V595<\/a> The &#8216;ilt&#8217; pointer was utilized before it was verified against nullptr. Check lines: 667, 669. ecore_init_ops.h 667<\/p>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c\u0441\u044f \u043f\u043e\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0432\u0441\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u044e\u0442 \u0432\u0441\u044e \u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0430 \u0432 \u044d\u0442\u043e\u043c \u043a\u043e\u0434\u0435.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/3f0\/867\/7bb\/3f08677bb95117715550345b6f6a0784.png\" alt=\"Silent NULL\"\/><\/p>\n<p>  \u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c <i>ilt <\/i> \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f:  <\/p>\n<pre><code class=\"cpp\">struct ilt_client_info *ilt_cli = &amp;ilt-&gt;clients[cli_num];<\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043e\u043d \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e NULL:  <\/p>\n<pre><code class=\"cpp\">if (!ilt || !ilt-&gt;lines)<\/code><\/pre>\n<p>  \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0443\u043b\u0435\u0432\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f. \u042d\u0442\u043e \u043d\u0435\u0438\u0437\u0431\u0435\u0436\u043d\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<\/p>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e\u0437\u0440\u0430\u0437\u044f\u0442, \u0447\u0442\u043e \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u0431\u0435\u0434\u044b \u043d\u0435\u0442, \u0442\u0430\u043a \u043a\u0430\u043a \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u00ab\u043d\u0435 \u043f\u043e-\u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u043c\u0443\u00bb. \u041e\u043d\u0438 \u0441\u043a\u0430\u0436\u0443\u0442, \u0447\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u0434\u0440\u0435\u0441 \u044f\u0447\u0435\u0439\u043a\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430. \u0414\u0430, \u0441\u043a\u0430\u0436\u0443\u0442 \u043e\u043d\u0438, \u044d\u0442\u043e\u0442 \u0430\u0434\u0440\u0435\u0441 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0435\u043d \u0438 \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f. \u041e\u0434\u043d\u0430\u043a\u043e, \u043d\u0438\u0436\u0435 \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430, \u0438 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442 \u0432\u044b\u0445\u043e\u0434 \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0435\u0441\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c <i>ilt <\/i> \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u0435\u043d \u043d\u0443\u043b\u044e. \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043d\u0435\u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0439 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c <i>ilt_cli<\/i> \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0438\u0433\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0438 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u043d\u0435\u0442.<\/p>\n<p>  \u041e\u043d\u0438 \u043d\u0435 \u043f\u0440\u0430\u0432\u044b. \u041d\u0435\u043b\u044c\u0437\u044f \u0442\u0430\u043a \u0440\u0430\u0437\u043c\u044b\u0448\u043b\u044f\u0442\u044c. \u0420\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0443\u043b\u0435\u0432\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044e. \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043a\u043e\u0434 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0435\u043d \u0438 \u043d\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0440\u0430\u0441\u0441\u0443\u0436\u0434\u0430\u0442\u044c, \u043a\u0430\u043a \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u041e\u043d \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043a\u0430\u043a \u0443\u0433\u043e\u0434\u043d\u043e.<\/p>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e, \u0442\u0430\u043a\u043e\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0447\u0430\u0441\u0442\u043e \u043d\u0435 \u0443\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u044e \u0440\u0430\u0437\u0432\u0438\u0442\u044c \u043c\u044b\u0441\u043b\u044c. \u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0437\u043d\u0430\u0435\u0442, \u0447\u0442\u043e \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0443\u043b\u0435\u0432\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u2014 \u044d\u0442\u043e \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435. \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0435\u0441\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u044e\u0442, \u0442\u043e \u043e\u043d \u043d\u0435 \u0440\u0430\u0432\u0435\u043d <i>NULL<\/i>. \u0420\u0430\u0437 \u043e\u043d \u043d\u0435 \u0440\u0430\u0432\u0435\u043d <i>NULL,<\/i> \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0438\u043c\u0435\u0435\u0442 \u043f\u043e\u043b\u043d\u043e\u0435 \u043f\u0440\u0430\u0432\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 <i>if (!ilt)<\/i>. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435, \u0435\u0441\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u0435\u043d <i>NULL<\/i>, \u0442\u043e \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442 \u0432\u044b\u0445\u043e\u0434. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0430\u0447\u043d\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043d\u0435\u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0447\u0435\u043c\u0443 \u0443\u0433\u043e\u0434\u043d\u043e.<\/p>\n<p>  \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e\u0437\u0440\u0430\u0436\u0430\u044e\u0442, \u0433\u043e\u0432\u043e\u0440\u044f, \u0447\u0442\u043e \u043c\u0430\u043a\u0440\u043e\u0441 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Offsetof\">offsetof<\/a> \u0438\u043d\u043e\u0433\u0434\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:  <\/p>\n<pre><code class=\"cpp\">#define offsetof(st, m) ((size_t)(&amp;((st *)0)-&gt;m))<\/code><\/pre>\n<p>  <i>\u0417\u0434\u0435\u0441\u044c \u0438\u043c\u0435\u0435\u0442 \u043c\u0435\u0441\u0442\u043e \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0443\u043b\u0435\u0432\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f, \u043d\u043e \u043a\u043e\u0434 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u044d\u0442\u043e \u0434\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0432\u043f\u043e\u043b\u043d\u0435 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b.<\/i><\/p>\n<p>  \u0418 \u0432\u043d\u043e\u0432\u044c \u043e\u043d\u0438 \u043d\u0435 \u043f\u0440\u0430\u0432\u044b. \u041d\u0438\u0447\u0435\u0433\u043e \u044d\u0442\u043e \u043d\u0435 \u0434\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442. <\/p>\n<p>  \u041f\u0440\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u0438 \u0438\u0434\u0438\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 <i>offsetof<\/i> \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0443 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u044b\u0435 \u043f\u0440\u0438\u0435\u043c\u044b \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0422\u043e\u0442 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0432 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430 \u043d\u0443\u043b\u0435\u0432\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u043f\u0440\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 <i>offsetof<\/i>, \u0432\u043e\u0432\u0441\u0435 \u043d\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0432 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u043c \u043a\u043e\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u0431\u0435\u0437 \u043e\u043f\u0430\u0441\u043a\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c <i>&amp;ilt-&gt;clients[cli_num]<\/i> \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043e\u0433\u0434\u0430 <i>ilt<\/i> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0443\u043b\u0435\u0432\u044b\u043c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u043c.<\/p>\n<p>  \u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0441 \u044d\u0442\u043e\u0439 \u0442\u0435\u043c\u043e\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0432 \u043c\u043e\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 &quot;<a href=\"https:\/\/www.viva64.com\/ru\/b\/0306\/\">\u0420\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u043d\u0438\u0435 \u043d\u0443\u043b\u0435\u0432\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044e<\/a>&quot;.<\/p>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435, \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435 \u043a\u043e\u0434 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0441\u0430\u043c\u0443\u044e \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443 \u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c \u0441 \u043d\u044e\u0430\u043d\u0441\u0430\u043c\u0438 \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0443\u043b\u0435\u0432\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f, \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f:  <\/p>\n<pre><code class=\"cpp\">static struct iscsi_outstanding * iscsi_outstanding_add(struct iscsi_session *is,                       struct icl_pdu *request,                       union ccb *ccb,                       uint32_t *initiator_task_tagp) {   struct iscsi_outstanding *io;   int error;    ISCSI_SESSION_LOCK_ASSERT(is);    io = uma_zalloc(iscsi_outstanding_zone, M_NOWAIT | M_ZERO);   if (io == NULL) {     ISCSI_SESSION_WARN(is, &quot;failed to allocate %zd bytes&quot;,         sizeof(*io));     return (NULL);   }    error = icl_conn_task_setup(is-&gt;is_conn, request, &amp;ccb-&gt;csio,     initiator_task_tagp, &amp;io-&gt;io_icl_prv);   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio: <a href=\"http:\/\/www.viva64.com\/ru\/w\/V522\/\">V522<\/a> Dereferencing of the null pointer &#8216;ccb&#8217; might take place. The null pointer is passed into &#8216;iscsi_outstanding_add&#8217; function. Inspect the third argument. Check lines: &#8216;iscsi.c:2157&#8217;. iscsi.c 2091<\/p>\n<p>  \u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043f\u043e\u0447\u0435\u043c\u0443 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0440\u0435\u0448\u0438\u043b, \u0447\u0442\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c <i>ccb <\/i> \u0431\u0443\u0434\u0435\u0442 \u043d\u0443\u043b\u0435\u0432\u044b\u043c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0431\u0440\u0430\u0442\u0438\u043c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0432 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0438 \u0435\u0449\u0451 \u0438 \u0432\u043e\u0442 \u0441\u044e\u0434\u0430: iscsi.c:2157.<\/p>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <i>iscsi_outstanding_add<\/i>, \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f <i>NULL<\/i>:  <\/p>\n<pre><code class=\"cpp\">static void iscsi_action_abort(struct iscsi_session *is, union ccb *ccb) {   ....   io = iscsi_outstanding_add(is, request, NULL,                              &amp;initiator_task_tag);   .... }<\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0443 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u043e\u0441\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043c\u0435\u0436\u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u0438\u0437, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u0434\u0435\u0444\u0435\u043a\u0442.<\/p>\n<p>  \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u0442\u0434\u043e\u0445\u043d\u0435\u043c \u043e\u0442 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043e\u0432\u0441\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a.  <\/p>\n<pre><code class=\"cpp\">int radeon_cs_ioctl(struct drm_device *dev, void *data,                     struct drm_file *fpriv) {   ....   struct drm_radeon_private *dev_priv = dev-&gt;dev_private;   ....   if (dev_priv == NULL) {     DRM_ERROR(&quot;called with no initialization\\n&quot;);     mtx_unlock(&amp;dev_priv-&gt;cs.cs_mutex);     return -EINVAL;   }   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio: <a href=\"http:\/\/www.viva64.com\/ru\/w\/V522\/\">V522<\/a> Dereferencing of the null pointer &#8216;dev_priv&#8217; might take place. radeon_cs.c 153<\/p>\n<p>  \u0422\u0435\u043b\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <i>if <\/i> \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0433\u0434\u0430 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c <i>dev_priv<\/i> \u0440\u0430\u0432\u0435\u043d \u043d\u0443\u043b\u044e. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0437\u0434\u0435\u0441\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e \u043a\u0430\u043a\u043e\u0439 \u0430\u0434\u0440\u0435\u0441: <i>&amp;dev_priv-&gt;cs.cs_mutex<\/i>. \u0414\u0430 \u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u044d\u0442\u043e UB.<\/p>\n<p>  \u041e\u0445. \u0427\u0442\u043e-\u0442\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u043d\u0443\u043b\u0435\u0432\u044b\u043c\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f\u043c\u0438 \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u044e\u0442\u0441\u044f. \u041d\u043e \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c, \u0440\u0430\u0437 \u044d\u0442\u043e \u0433\u043e\u043b\u043e\u0432\u043d\u0430\u044f \u0431\u043e\u043b\u044c \u043c\u043d\u043e\u0433\u0438\u0445 \u044f\u0437\u044b\u043a\u043e\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0422\u0430\u043a \u0447\u0442\u043e \u0437\u0430\u0432\u0430\u0440\u0438\u0442\u0435 \u043a\u043e\u0444\u0435 \u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0439\u0442\u0435 \u0447\u0442\u0435\u043d\u0438\u0435.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/67b\/c5c\/fa1\/67bc5cfa1cb578d70303c56d3ad2c308.png\" alt=\"NULL\"\/><\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">static void bwn_txpwr(void *arg, int npending) {   struct bwn_mac *mac = arg;   struct bwn_softc *sc = mac-&gt;mac_sc;    BWN_LOCK(sc);   if (mac &amp;&amp; mac-&gt;mac_status &gt;= BWN_MAC_STATUS_STARTED &amp;&amp;       mac-&gt;mac_phy.set_txpwr != NULL)     mac-&gt;mac_phy.set_txpwr(mac);   BWN_UNLOCK(sc); }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio: <a href=\"http:\/\/www.viva64.com\/ru\/w\/V595\/\">V595<\/a> The &#8216;mac&#8217; pointer was utilized before it was verified against nullptr. Check lines: 6757, 6760. if_bwn.c 6757<\/p>\n<p>  \u0423\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c <i>mac<\/i> \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0430 \u0434\u0430\u043b\u0435\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e <i>NULL<\/i>. \u0417\u0434\u0435\u0441\u044c \u0432\u0441\u0451 \u043f\u0440\u043e\u0441\u0442\u043e, \u0442\u0430\u043a \u0447\u0442\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0443.  <\/p>\n<pre><code class=\"cpp\">struct opcode_obj_rewrite *ctl3_rewriters; void ipfw_add_obj_rewriter(struct opcode_obj_rewrite *rw,                       size_t count) {   ....   memcpy(tmp, ctl3_rewriters, ctl3_rsize * sizeof(*rw));  \/\/ &lt;=   memcpy(&amp;tmp[ctl3_rsize], rw, count * sizeof(*rw));   qsort(tmp, sz, sizeof(*rw), compare_opcodes);   \/* Switch new and free old *\/   if (ctl3_rewriters != NULL)                             \/\/ &lt;=     free(ctl3_rewriters, M_IPFW);   ctl3_rewriters = tmp;   ctl3_rsize = sz;    CTL3_UNLOCK(); }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio: <a href=\"http:\/\/www.viva64.com\/ru\/w\/V595\/\">V595<\/a> The &#8216;ctl3_rewriters&#8217; pointer was utilized before it was verified against nullptr. Check lines: 3206, 3210. ip_fw_sockopt.c 3206<\/p>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0432\u043d\u0430\u0447\u0430\u043b\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c <i>ctl3_rewriters<\/i> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <i>memcpy<\/i>:  <\/p>\n<pre><code class=\"cpp\">memcpy(tmp, ctl3_rewriters, ctl3_rsize * sizeof(*rw));<\/code><\/pre>\n<p>  \u0410 \u0437\u0430\u0442\u0435\u043c \u0432\u0434\u0440\u0443\u0433 \u0432\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u044e\u0442, \u0447\u0442\u043e \u0435\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043d\u0430 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e <i>NULL<\/i>:  <\/p>\n<pre><code class=\"cpp\">if (ctl3_rewriters != NULL)<\/code><\/pre>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u0441\u043b\u0443\u0447\u0430\u0439 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0434\u043b\u044f \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432:  <\/p>\n<pre><code class=\"cpp\">static int mly_user_command(struct mly_softc *sc, struct mly_user_command *uc) {   struct mly_command  *mc;   ....   if (mc-&gt;mc_data != NULL)           \/\/ &lt;=     free(mc-&gt;mc_data, M_DEVBUF);     \/\/ &lt;=   if (mc != NULL) {                  \/\/ &lt;=     MLY_LOCK(sc);     mly_release_command(mc);     MLY_UNLOCK(sc);   }   return(error); }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio: <a href=\"http:\/\/www.viva64.com\/ru\/w\/V595\/\">V595<\/a> The &#8216;mc&#8217; pointer was utilized before it was verified against nullptr. Check lines: 2954, 2955. mly.c 2954<\/p>\n<p>  \u0421\u0442\u043e\u0438\u0442 \u0437\u0430\u043a\u0440\u0443\u0433\u043b\u044f\u0442\u044c\u0441\u044f \u0441 \u043d\u0443\u043b\u0435\u0432\u044b\u043c\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f\u043c\u0438, \u0442\u0430\u043a \u043a\u0430\u043a, \u0434\u0443\u043c\u0430\u044e, \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0442\u0430\u043a\u0438\u0445 \u043e\u0448\u0438\u0431\u043e\u043a \u0443\u0436\u0435 \u043d\u0430\u0441\u043a\u0443\u0447\u0438\u043b\u043e \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u043d\u0435, \u043d\u043e \u0438 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044e. \u042f \u0432\u0438\u0436\u0443 CWE-476 (NULL Pointer Dereference) \u0435\u0449\u0451 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0443\u0447\u0430\u0441\u0442\u043a\u0430\u0445 \u043a\u043e\u0434\u0430:<\/p>\n<ul>\n<li>V595 The &#8216;cm&#8217; pointer was utilized before it was verified against nullptr. Check lines: 3361, 3381. mfi.c 3361<\/li>\n<li>V595 The &#8216;cm&#8217; pointer was utilized before it was verified against nullptr. Check lines: 1383, 1394. mpr_sas_lsi.c 1383<\/li>\n<li>V595 The &#8216;cm&#8217; pointer was utilized before it was verified against nullptr. Check lines: 1258, 1269. mps_sas_lsi.c 1258<\/li>\n<li>V595 The &#8216;ctl3_handlers&#8217; pointer was utilized before it was verified against nullptr. Check lines: 3441, 3445. ip_fw_sockopt.c 3441<\/li>\n<li>V595 The &#8216;ccb&#8217; pointer was utilized before it was verified against nullptr. Check lines: 540, 547. iscsi_subr.c 540<\/li>\n<li>V595 The &#8216;satOrgIOContext&#8217; pointer was utilized before it was verified against nullptr. Check lines: 11341, 11344. smsatcb.c 11341<\/li>\n<li>V595 The &#8216;satOrgIOContext&#8217; pointer was utilized before it was verified against nullptr. Check lines: 11498, 11501. smsatcb.c 11498<\/li>\n<li>V595 The &#8216;m&#8217; pointer was utilized before it was verified against nullptr. Check lines: 1153, 1157. midi.c 1153<\/li>\n<li>V595 The &#8216;m&#8217; pointer was utilized before it was verified against nullptr. Check lines: 1153, 1157. midi.c 1153<\/li>\n<li>V595 The &#8216;es&#8217; pointer was utilized before it was verified against nullptr. Check lines: 1882, 1893. es137x.c 1882<\/li>\n<li>V595 The &#8216;via&#8217; pointer was utilized before it was verified against nullptr. Check lines: 1375, 1392. via8233.c 1375<\/li>\n<li>V595 The &#8216;via&#8217; pointer was utilized before it was verified against nullptr. Check lines: 604, 613. via82c686.c 604<\/li>\n<\/ul>\n<p>  \u041d\u043e \u0438 \u044d\u0442\u043e \u0435\u0449\u0451 \u043d\u0435 \u0432\u0441\u0451! \u041c\u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0441\u043a\u0443\u0447\u0438\u043b\u043e \u0438\u0437\u0443\u0447\u0430\u0442\u044c \u044d\u0442\u0443 \u0440\u0430\u0437\u043d\u043e\u0432\u0438\u0434\u043d\u043e\u0441\u0442\u044c \u043e\u0448\u0438\u0431\u043e\u043a, \u0438 \u044f \u043f\u0435\u0440\u0435\u0448\u0435\u043b \u043a \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044e \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0442\u0438\u043f\u0430. \u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 PVS-Studio \u0436\u0434\u0451\u0442 \u0433\u0435\u0440\u043e\u0435\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437\u0443\u0447\u0430\u0442 \u0432\u0441\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u0430\u0441\u0430\u044e\u0442\u0441\u044f \u043d\u0443\u043b\u0435\u0432\u044b\u0445 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439.<\/p>\n<h3>CWE-467: Use of sizeof() on a Pointer Type<\/h3>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b <i>pfloghdr<\/i>:  <\/p>\n<pre><code class=\"cpp\">struct pfloghdr {   u_int8_t  length;   sa_family_t  af;   u_int8_t  action;   u_int8_t  reason;   char    ifname[IFNAMSIZ];   char    ruleset[PFLOG_RULESET_NAME_SIZE];   u_int32_t  rulenr;   u_int32_t  subrulenr;   uid_t    uid;   pid_t    pid;   uid_t    rule_uid;   pid_t    rule_pid;   u_int8_t  dir;   u_int8_t  pad[3]; };<\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u0442\u0430\u043a\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0430\u044f. \u0414\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0430, \u043a\u043e\u0433\u0434\u0430 \u0432\u0441\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0443\u043b\u044f\u043c\u0438, \u0430 \u043f\u043e\u0442\u043e\u043c \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0439.<\/p>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e, \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <i>nat64lsn_log<\/i> \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u043e\u0434 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438:  <\/p>\n<pre><code class=\"cpp\">static void nat64lsn_log(struct pfloghdr *plog, ....) {   memset(plog, 0, sizeof(plog));        \/\/ &lt;=   plog-&gt;length = PFLOG_REAL_HDRLEN;   plog-&gt;af = family;   plog-&gt;action = PF_NAT;   plog-&gt;dir = PF_IN;   plog-&gt;rulenr = htonl(n);   plog-&gt;subrulenr = htonl(sn);   plog-&gt;ruleset[0] = '\\0';   strlcpy(plog-&gt;ifname, &quot;NAT64LSN&quot;, sizeof(plog-&gt;ifname));   ipfw_bpf_mtap2(plog, PFLOG_HDRLEN, m); }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio: <a href=\"http:\/\/www.viva64.com\/ru\/w\/V512\/\">V512<\/a> A call of the &#8216;memset&#8217; function will lead to underflow of the buffer &#8216;plog&#8217;. nat64lsn.c 218<\/p>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e <i>sizeof(plog)<\/i> \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u043d\u0435 \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u0430 \u0440\u0430\u0437\u043c\u0435\u0440 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043e\u0431\u043d\u0443\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435 \u0432\u0441\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430, \u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0432\u044b\u0445 \u0431\u0430\u0439\u0442, \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u043b\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043b\u044f \u0437\u0430\u0442\u0435\u043c \u044f\u0432\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u041e\u0434\u043d\u0430\u043a\u043e, \u0440\u044f\u0434 \u0447\u043b\u0435\u043d\u043e\u0432 \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438.<\/p>\n<p>  \u0422\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u0443\u044e \u0436\u0435 \u043e\u0448\u0438\u0431\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u044c \u0432 \u0444\u0430\u0439\u043b\u0435 nat64stl.c: <a href=\"http:\/\/www.viva64.com\/ru\/w\/V512\/\">V512<\/a> A call of the &#8216;memset&#8217; function will lead to underflow of the buffer &#8216;plog&#8217;. nat64stl.c 72<\/p>\n<h3>CWE-457: Use of Uninitialized Variable<\/h3>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0435\u0449\u0451 \u043e\u0434\u043d\u0443 \u043e\u0448\u0438\u0431\u043a\u0443, \u0438\u0437-\u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0430.  <\/p>\n<pre><code class=\"cpp\">osGLOBAL bit32 tdsaSendTMFIoctl(       tiRoot_t             *tiRoot,       tiIOCTLPayload_t     *agIOCTLPayload,       void                 *agParam1,       void                 *agParam2,       unsigned long        resetType     ) {   bit32    status;   tmf_pass_through_req_t  *tmf_req = ....; #if !(defined(__FreeBSD__))   status = ostiSendResetDeviceIoctl(tiRoot, agParam2,     tmf_req-&gt;pathId, tmf_req-&gt;targetId, tmf_req-&gt;lun, resetType); #endif   TI_DBG3((     &quot;Status returned from ostiSendResetDeviceIoctl is %d\\n&quot;,     status));   if(status != IOCTL_CALL_SUCCESS)   {     agIOCTLPayload-&gt;Status = status;     return status;   }   status = IOCTL_CALL_SUCCESS;   return status; }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio: <a href=\"http:\/\/www.viva64.com\/ru\/w\/V614\/\">V614<\/a> Uninitialized variable &#8216;status&#8217; used. tdioctl.c 3396<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d \u043c\u0430\u043a\u0440\u043e\u0441 <i>__FreeBSD__<\/i> (\u0430 \u043e\u043d \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d), \u0442\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0435  <\/p>\n<pre><code class=\"cpp\">#if !(defined(__FreeBSD__))<\/code><\/pre>\n<p>  \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f. \u041a\u0430\u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043a\u043e\u0434 \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 <i>#if&#8230;#endif<\/i> \u043d\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f, \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <i>status<\/i> \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439.<\/p>\n<h3>CWE-805: Buffer Access with Incorrect Length Value<\/h3>\n<p>  <\/p>\n<pre><code class=\"cpp\">typedef struct qls_mpid_glbl_hdr {   uint32_t  cookie;   uint8_t   id[16];   uint32_t  time_lo;   .... } qls_mpid_glbl_hdr_t;  struct qls_mpi_coredump {   qls_mpid_glbl_hdr_t  mpi_global_header;   .... };  typedef struct qls_mpi_coredump qls_mpi_coredump_t;  int qls_mpi_core_dump(qla_host_t *ha) {   ....   qls_mpi_coredump_t *mpi_dump = &amp;ql_mpi_coredump;   ....   memcpy(mpi_dump-&gt;mpi_global_header.id, &quot;MPI Coredump&quot;,          sizeof(mpi_dump-&gt;mpi_global_header.id));   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio: <a href=\"http:\/\/www.viva64.com\/ru\/w\/V512\/\">V512<\/a> A call of the &#8216;memcpy&#8217; function will lead to the &#8216;\u00abMPI Coredump\u00bb&#8217; buffer becoming out of range. qls_dump.c 1615<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0430\u043a \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u044b \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0438\u0435 \u043d\u0430\u0441 \u0442\u0438\u043f\u044b \u0438 \u0447\u043b\u0435\u043d\u044b \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430. \u041d\u043e \u043d\u0435 \u0441\u043f\u0435\u0448\u0438\u0442\u0435 \u0437\u0435\u0432\u0430\u0442\u044c, \u0441\u0435\u0439\u0447\u0430\u0441 \u044f \u0432\u044b\u0434\u0435\u043b\u044e \u0441\u0430\u043c\u043e\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435:  <\/p>\n<pre><code class=\"cpp\">uint8_t id[16]; memcpy(id, &quot;MPI Coredump&quot;, sizeof(id));<\/code><\/pre>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0441 \u0432\u0430\u0436\u043d\u043e:<\/p>\n<ol>\n<li>\u041e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <i>sizeof<\/i> \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0447\u0438\u0441\u043b\u043e 16.<\/li>\n<li>\u0421\u0442\u0440\u043e\u043a\u0430 \u00abMPI Coredump\u00bb \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043d\u0443\u043b\u044f \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 13 \u0431\u0430\u0439\u0442.<\/li>\n<\/ol>\n<p>  \u0411\u0443\u0434\u0435\u0442 \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u043e 13 \u0431\u0430\u0439\u0442 \u0441\u0442\u0440\u043e\u043a\u0438 \u0438 \u0435\u0449\u0451 3 \u0431\u0430\u0439\u0442\u0430, \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u043f\u043e\u0441\u043b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438. \u0422\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u043c\u043e\u0436\u0435\u0442 \u0434\u0430\u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u041f\u0440\u043e\u0441\u0442\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442\u0441\u044f 3 \u0431\u0430\u0439\u0442\u0430 \u0441 \u043c\u0443\u0441\u043e\u0440\u043e\u043c \u0438\u043b\u0438 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438. \u041e\u0434\u043d\u0430\u043a\u043e, \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e, \u044d\u0442\u043e \u0432\u044b\u0445\u043e\u0434 \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0430, \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<\/p>\n<h3>CWE-129: Improper Validation of Array Index<\/h3>\n<p>  \u0412\u043e\u0442 \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043b\u0441\u044f \u0441\u043b\u0443\u0447\u0430\u0439 \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0430\u043c \u043e\u0434\u043d\u0443 \u0438\u0437 \u043d\u043e\u0432\u044b\u0445 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0432 PVS-Studio. \u0421\u0443\u0442\u044c \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0438 <a href=\"https:\/\/www.viva64.com\/ru\/w\/V781\/\">V781<\/a>:<\/p>\n<p>  <i>\u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0438\u043b\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430. \u0410 \u0443\u0436\u0435 \u0437\u0430\u0442\u0435\u043c \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441 0 \u0438\u043b\u0438 \u0441 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0430. \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 \u043a\u043e\u0434\u0435 \u0438\u043b\u0438 \u043e\u043f\u0435\u0447\u0430\u0442\u043a\u0443 \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439.<\/i><\/p>\n<p>  \u041f\u043e \u0441\u0432\u043e\u0435\u0439 \u0441\u0443\u0442\u0438 \u044d\u0442\u0430 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0430 \u0441\u0445\u043e\u0436\u0430 \u0441 <a href=\"https:\/\/www.viva64.com\/ru\/w\/V595\/\">V595<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0445\u043e\u0440\u043e\u0448\u043e \u0437\u043d\u0430\u043a\u043e\u043c\u0430 \u043c\u043e\u0438\u043c \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u043c \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f\u043c.  <\/p>\n<pre><code class=\"cpp\">\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0433\u0434\u0435 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0430 \u044d\u0442\u0430 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0430 \u043f\u0440\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u043a\u043e\u0434\u0430 FreeBSD. static void sbp_targ_mgm_handler(struct fw_xfer *xfer) {   ....   int exclusive = 0, lun;   ....   lun = orb4-&gt;id;   lstate = orbi-&gt;sc-&gt;lstate[lun];    if (lun &gt;= MAX_LUN || lstate == NULL ||       (exclusive &amp;&amp;       STAILQ_FIRST(&amp;lstate-&gt;logins) != NULL &amp;&amp;       STAILQ_FIRST(&amp;lstate-&gt;logins)-&gt;fwdev != orbi-&gt;fwdev)      ) {     \/* error *\/     orbi-&gt;status.dead = 1;     orbi-&gt;status.status = STATUS_ACCESS_DENY;     orbi-&gt;status.len = 1;     break;   }   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio: <a href=\"http:\/\/www.viva64.com\/ru\/w\/V781\/\">V781<\/a> The value of the &#8216;lun&#8217; variable is checked after it was used. Perhaps there is a mistake in program logic. Check lines: 1617, 1619. sbp_targ.c 1617<\/p>\n<p>  \u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u0441\u043c\u0435\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0438\u043d\u0434\u0435\u043a\u0441 <i>lun <\/i> \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043c\u0430\u0441\u0441\u0438\u0432\u0443 <i>lstate<\/i>. \u0418 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0442\u0435\u043c \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430: \u043d\u0435 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 \u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u043e \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0440\u0430\u0432\u043d\u043e\u0435 <i>MAX_LUN<\/i>? \u0415\u0441\u043b\u0438 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442, \u0442\u043e \u044d\u0442\u0430 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u0430\u044f. \u041d\u043e \u0443\u0436\u0435 \u043f\u043e\u0437\u0434\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0443\u0436\u0435 \u043c\u043e\u0433\u043b\u0438 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u0434\u0430\u043b\u0435\u043a\u043e \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044b \u043c\u0430\u0441\u0441\u0438\u0432\u0430.<\/p>\n<p>  \u0424\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e, \u044d\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u0442 \u043a \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u041d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435, \u0432\u043c\u0435\u0441\u0442\u043e \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c <a href=\"https:\/\/www.viva64.com\/ru\/t\/0063\/\">Access Violation<\/a>.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430.  <\/p>\n<pre><code class=\"cpp\">#define R88E_GROUP_2G    6 #define RTWN_RIDX_OFDM6  4 #define RTWN_RIDX_COUNT  28  struct rtwn_r88e_txagc {   uint8_t pwr[R88E_GROUP_2G][20];  \/* RTWN_RIDX_MCS(7) + 1 *\/ };  void r88e_get_txpower(struct rtwn_softc *sc, int chain,     struct ieee80211_channel *c, uint16_t power[RTWN_RIDX_COUNT]) {   const struct rtwn_r88e_txagc *base = rs-&gt;rs_txagc;   ....   for (ridx = RTWN_RIDX_OFDM6; ridx &lt; RTWN_RIDX_COUNT; ridx++) {     if (rs-&gt;regulatory == 3)       power[ridx] = base-&gt;pwr[0][ridx];     else if (rs-&gt;regulatory == 1) {       if (!IEEE80211_IS_CHAN_HT40(c))         power[ridx] = base-&gt;pwr[group][ridx];     } else if (rs-&gt;regulatory != 2)       power[ridx] = base-&gt;pwr[0][ridx];   }   .... }<\/code><\/pre>\n<p>  \u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0432\u044b\u0434\u0430\u043b \u0437\u0434\u0435\u0441\u044c \u0442\u0440\u0438 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u043d\u0430 \u0442\u0440\u0438 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u0433\u0434\u0435 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043c\u0430\u0441\u0441\u0438\u0432\u0443 <i>pwr<\/i>:<\/p>\n<ul>\n<li>V557 Array overrun is possible. The value of &#8216;ridx&#8217; index could reach 27. r88e_chan.c 115<\/li>\n<li>V557 Array overrun is possible. The value of &#8216;ridx&#8217; index could reach 27. r88e_chan.c 118<\/li>\n<li>V557 Array overrun is possible. The value of &#8216;ridx&#8217; index could reach 27. r88e_chan.c 120<\/li>\n<\/ul>\n<p>  \u0412 \u0446\u0438\u043a\u043b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 <i>ridx<\/i> \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <i>RTWN_RIDX_OFDM6<\/i> \u0434\u043e <i>RTWN_RIDX_COUNT<\/i>. \u0422\u043e \u0435\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <i>ridx<\/i> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 [4..27]. \u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u0432\u0441\u0451 \u0445\u043e\u0440\u043e\u0448\u043e. <\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u043e\u0448\u0438\u0431\u043a\u0443, \u043e\u0431\u0440\u0430\u0442\u0438\u043c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0447\u043b\u0435\u043d <i>pwr<\/i>, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0441\u043e\u0431\u043e\u0439 \u0434\u0432\u0443\u0445\u043c\u0435\u0440\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432:  <\/p>\n<pre><code class=\"cpp\">uint8_t pwr[R88E_GROUP_2G][20];    \/\/ R88E_GROUP_2G == 6<\/code><\/pre>\n<p>  \u0418 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0435\u0449\u0451 \u0440\u0430\u0437 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u044d\u0442\u043e\u043c\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0443 \u0432 \u0446\u0438\u043a\u043b\u0435:  <\/p>\n<pre><code class=\"cpp\">base-&gt;pwr[0][ridx]                 \/\/ ridx=[4..27] base-&gt;pwr[group][ridx]             \/\/ ridx=[4..27] base-&gt;pwr[0][ridx]                 \/\/ ridx=[4..27]<\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u044f\u0432\u043d\u043e \u0447\u0442\u043e-\u0442\u043e \u043d\u0435 \u0442\u0430\u043a. \u041f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u044b\u0445\u043e\u0434 \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430. \u041e\u0434\u043d\u0430\u043a\u043e, \u044f \u0437\u0430\u0442\u0440\u0443\u0434\u043d\u044f\u044e\u0441\u044c \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c, \u043a\u0430\u043a \u0434\u043e\u043b\u0436\u0435\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0438 \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c.<\/p>\n<h3>CWE-483: Incorrect Block Delimitation<\/h3>\n<p>  <\/p>\n<pre><code class=\"cpp\">static int smbfs_getattr(ap) struct vop_getattr_args *ap; {   ....   if (np-&gt;n_flag &amp; NOPEN)     np-&gt;n_size = oldsize;     smbfs_free_scred(scred);   return 0; }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio: <a href=\"http:\/\/www.viva64.com\/ru\/w\/V640\/\">V640<\/a> The code&#8217;s operational logic does not correspond with its formatting. The statement is indented to the right, but it is always executed. It is possible that curly brackets are missing. smbfs_vnops.c 283<\/p>\n<p>  \u041e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 \u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043b\u043e\u0433\u0438\u043a\u0435 \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b. \u0412\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0441\u0442\u0440\u043e\u0447\u043a\u0430 <i>smbfs_free_scred(scred);<\/i> \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e, \u0435\u0441\u043b\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0438\u0441\u0442\u0438\u043d\u043d\u043e. \u041d\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u044d\u0442\u0430 \u0441\u0442\u043e\u0447\u043a\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u0434\u0430.<\/p>\n<p>  \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0439 \u043e\u0448\u0438\u0431\u043a\u0438 \u0437\u0434\u0435\u0441\u044c \u043d\u0435\u0442, \u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0442\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434, \u043d\u043e, \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u044d\u0442\u043e\u0442 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u043a\u043e\u0434\u0430 \u0437\u0430\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0435\u0442 \u0441\u0430\u043c\u043e\u0433\u043e \u043f\u0440\u0438\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f.<\/p>\n<p>  \u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0432\u044b\u044f\u0432\u0438\u043b \u0435\u0449\u0451 4 \u0447\u0435\u0442\u044b\u0440\u0435 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0445 \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430 \u043a\u043e\u0434\u0430, \u043d\u043e \u043d\u0435 \u0431\u0443\u0434\u0443 \u0438\u0445 \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u0438 \u0432\u0441\u0435 \u043e\u0434\u043d\u043e\u0442\u0438\u043f\u043d\u044b. \u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0443\u0441\u044c \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f\u043c\u0438:<\/p>\n<ul>\n<li>V640 The code&#8217;s operational logic does not correspond with its formatting. The statement is indented to the right, but it is always executed. It is possible that curly brackets are missing. ctl.c 8569<\/li>\n<li>V640 The code&#8217;s operational logic does not correspond with its formatting. The statement is indented to the right, but it is always executed. It is possible that curly brackets are missing. ieee80211_ioctl.c 2019<\/li>\n<li>V640 The code&#8217;s operational logic does not correspond with its formatting. The statement is indented to the right, but it is always executed. It is possible that curly brackets are missing. in_mcast.c 1063<\/li>\n<li>V640 The code&#8217;s operational logic does not correspond with its formatting. The statement is indented to the right, but it is always executed. It is possible that curly brackets are missing. in6_mcast.c 1004<\/li>\n<\/ul>\n<p>  <\/p>\n<h3>CWE-563: Assignment to Variable without Use (&#8216;Unused Variable&#8217;)<\/h3>\n<p>  <\/p>\n<pre><code class=\"cpp\">int ipf_p_ftp_port(softf, fin, ip, nat, ftp, dlen)   ipf_ftp_softc_t *softf;   fr_info_t *fin;   ip_t *ip;   nat_t *nat;   ftpinfo_t *ftp;   int dlen; {   ....   if (nat-&gt;nat_dir == NAT_INBOUND)     a1 = ntohl(nat-&gt;nat_ndstaddr);   \/\/ &lt;=   else     a1 = ntohl(ip-&gt;ip_src.s_addr);   \/\/ &lt;=   a1 = ntohl(ip-&gt;ip_src.s_addr);     \/\/ &lt;=   a2 = (a1 &gt;&gt; 16) &amp; 0xff;   a3 = (a1 &gt;&gt; 8) &amp; 0xff;   a4 = a1 &amp; 0xff;   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio: <a href=\"http:\/\/www.viva64.com\/ru\/w\/V519\/\">V519<\/a> The &#8216;a1&#8217; variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 397, 400. ip_ftp_pxy.c 400<\/p>\n<p>  \u041d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442 \u0443\u0441\u043b\u043e\u0432\u0438\u044f, \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <i>a1<\/i> \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <i>ntohl(ip-&gt;ip_src.s_addr)<\/i>.<\/p>\n<p>  \u041c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438\u0448\u043d\u0438\u043c. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u043e\u0433\u043e \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u0430.<\/p>\n<p>  \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u043c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043e\u043a \u044d\u0442\u043e\u0439 \u0440\u0430\u0437\u043d\u043e\u0432\u0438\u0434\u043d\u043e\u0441\u0442\u0438:  <\/p>\n<pre><code class=\"cpp\">static inline int ecore_func_send_switch_update(   struct bxe_softc *sc,   struct ecore_func_state_params *params) {   ....   if (ECORE_TEST_BIT(ECORE_F_UPDATE_VLAN_FORCE_PRIO_FLAG,                      &amp;switch_update_params-&gt;changes))      rdata-&gt;sd_vlan_force_pri_flg = 1;   rdata-&gt;sd_vlan_force_pri_flg =     switch_update_params-&gt;vlan_force_prio;   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio: <a href=\"http:\/\/www.viva64.com\/ru\/w\/V519\/\">V519<\/a> The &#8216;rdata-&gt;sd_vlan_force_pri_flg&#8217; variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 6327, 6328. ecore_sp.c 6328<\/p>\n<p>  \u0421\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430\u044f, \u0442\u0430\u043a \u0447\u0442\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u043d\u0430 \u043d\u0435\u0439 \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f. \u0418\u0434\u0451\u043c \u0434\u0430\u043b\u044c\u0448\u0435.  <\/p>\n<pre><code class=\"cpp\">static int ixgbe_add_vf(device_t dev, u16 vfnum, const nvlist_t *config) {   ....   if (nvlist_exists_binary(config, &quot;mac-addr&quot;)) {     mac = nvlist_get_binary(config, &quot;mac-addr&quot;, NULL);     bcopy(mac, vf-&gt;ether_addr, ETHER_ADDR_LEN);     if (nvlist_get_bool(config, &quot;allow-set-mac&quot;))       vf-&gt;flags |= IXGBE_VF_CAP_MAC;   } else     \/*      * If the administrator has not specified a MAC address then      * we must allow the VF to choose one.      *\/     vf-&gt;flags |= IXGBE_VF_CAP_MAC;    vf-&gt;flags = IXGBE_VF_ACTIVE;   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio: <a href=\"http:\/\/www.viva64.com\/ru\/w\/V519\/\">V519<\/a> The &#8216;vf-&gt;flags&#8217; variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 5992, 5994. if_ix.c 5994<\/p>\n<p>  \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u043b\u0438 &quot;|&quot; \u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439 \u043a\u043e\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u043b \u0431\u044b\u0442\u044c \u0442\u0430\u043a\u0438\u043c:  <\/p>\n<pre><code class=\"cpp\">vf-&gt;flags |= IXGBE_VF_ACTIVE;<\/code><\/pre>\n<p>  \u0412\u043e\u043e\u0431\u0449\u0435, \u0432\u0441\u0435 \u044d\u0442\u0438 \u043e\u0448\u0438\u0431\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044e, \u043f\u0443\u0433\u0430\u044e\u0442. \u0422\u043e\u0447\u043d\u0435\u0435, \u0438\u0445 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e. \u0412\u0435\u0434\u044c \u044f \u0432\u0438\u0436\u0443, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0448\u0438\u0431\u043e\u043a \u0432\u044b\u043f\u0438\u0441\u0430\u043b, \u0438 \u0447\u0442\u043e \u043a\u043e\u043d\u0435\u0446 \u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0435 \u0431\u043b\u0438\u0437\u043e\u043a.  <\/p>\n<pre><code class=\"cpp\">typedef struct {   uint64_t  __mask; } l_sigset_t; int linux_sigreturn(struct thread *td,                 struct linux_sigreturn_args *args) {   l_sigset_t lmask;   ....   lmask.__mask = frame.sf_sc.sc_mask;   lmask.__mask = frame.sf_extramask[0];   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio: <a href=\"http:\/\/www.viva64.com\/ru\/w\/V519\/\">V519<\/a> The &#8216;lmask.__mask&#8217; variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 594, 595. linux32_sysvec.c 595  <\/p>\n<pre><code class=\"cpp\">static u_int sysctl_log_level = 0; .... int sysctl_chg_loglevel(SYSCTL_HANDLER_ARGS) {   u_int level = *(u_int *)arg1;   int error;   error = sysctl_handle_int(oidp, &amp;level, 0, req);   if (error) return (error);    sysctl_log_level =     (level &gt; SN_LOG_DEBUG_MAX)?(SN_LOG_DEBUG_MAX):(level);   sysctl_log_level =     (level &lt; SN_LOG_LOW)?(SN_LOG_LOW):(level);    return (0); }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio: <a href=\"http:\/\/www.viva64.com\/ru\/w\/V519\/\">V519<\/a> The &#8216;sysctl_log_level&#8217; variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 423, 424. alias_sctp.c 424<\/p>\n<p>  \u0412\u0438\u0434\u0438\u043c\u043e \u043a\u043e\u0434 \u043f\u0438\u0441\u0430\u043b\u0441\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u043c Copy-Paste, \u0438, \u043a\u0430\u043a \u0432\u0441\u0435\u0433\u0434\u0430, \u0438\u043c\u044f \u0441\u0430\u043c\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0437\u0430\u0431\u044b\u043b\u0438 \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c. \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u043b\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c:  <\/p>\n<pre><code class=\"cpp\">sysctl_log_level =   (level &lt; SN_LOG_LOW)?(SN_LOG_LOW):(sysctl_log_level);<\/code><\/pre>\n<p>  \u0421\u043c. \u0444\u0438\u043b\u043e\u0441\u043e\u0444\u0441\u043a\u043e-\u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443: &quot;<a href=\"https:\/\/www.viva64.com\/ru\/b\/0485\/\">\u041e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0441\u0442\u0440\u043e\u043a\u0438<\/a>&quot;.<\/p>\n<p>  \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u043c \u0438\u0437\u0443\u0447\u0430\u0442\u044c, \u043a\u0430\u043a \u0433\u043b\u0443\u0431\u043e\u043a\u0430 \u043a\u0440\u043e\u043b\u0438\u0447\u044c\u044f \u043d\u043e\u0440\u0430.  <\/p>\n<pre><code class=\"cpp\">static int uath_tx_start(struct uath_softc *sc, struct mbuf *m0,               struct ieee80211_node *ni, struct uath_data *data) {   ....   chunk-&gt;flags = (m0-&gt;m_flags &amp; M_FRAG) ? 0 : UATH_CFLAGS_FINAL;   if (m0-&gt;m_flags &amp; M_LASTFRAG)     chunk-&gt;flags |= UATH_CFLAGS_FINAL;   chunk-&gt;flags = UATH_CFLAGS_FINAL;   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio: <a href=\"http:\/\/www.viva64.com\/ru\/w\/V519\/\">V519<\/a> The &#8216;chunk-&gt;flags&#8217; variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 1566, 1567. if_uath.c 1567<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/7e3\/d7a\/2b4\/7e3d7a2b4f79589c495d92cf516b23b7.png\" alt=\"\u041a\u0440\u0438\u043a\"\/><\/p>\n<p>  \u041f\u043e\u0440\u0430 \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043a\u0430\u043a\u0443\u044e-\u0442\u043e \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u0434\u043b\u044f \u0440\u0430\u0441\u0441\u043b\u0430\u0431\u043b\u0435\u043d\u0438\u044f \u0438 \u043e\u0442\u0434\u044b\u0445\u0430. \u0414\u0443\u043c\u0430\u044e, \u044d\u0442\u0430 \u043a\u0430\u043a \u0440\u0430\u0437 \u043f\u043e\u0434\u043e\u0439\u0434\u0451\u0442.  <\/p>\n<pre><code class=\"cpp\">static void ch7017_mode_set(....) {   uint8_t lvds_pll_feedback_div, lvds_pll_vco_control;   ....   lvds_pll_feedback_div =     CH7017_LVDS_PLL_FEEDBACK_DEFAULT_RESERVED |     (2 &lt;&lt; CH7017_LVDS_PLL_FEED_BACK_DIVIDER_SHIFT) |     (3 &lt;&lt; CH7017_LVDS_PLL_FEED_FORWARD_DIVIDER_SHIFT);   lvds_pll_feedback_div = 35;   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio: <a href=\"http:\/\/www.viva64.com\/ru\/w\/V519\/\">V519<\/a> The &#8216;lvds_pll_feedback_div&#8217; variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 287, 290. dvo_ch7017.c 290<\/p>\n<p>  \u041f\u0435\u0440\u0435\u0442\u0438\u0440\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043c\u0430\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0447\u0438\u0441\u043b\u043e\u043c 35 \u043d\u0443 \u043e\u0447\u0435\u043d\u044c \u0441\u0442\u0440\u0430\u043d\u043d\u043e \u0438 \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e. \u041f\u043e\u0445\u043e\u0436\u0435, \u0447\u0442\u043e \u043a\u0442\u043e-\u0442\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u044d\u0442\u0443 \u0441\u0442\u0440\u043e\u0447\u043a\u0443 \u0432 \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u044b\u0445 \u0446\u0435\u043b\u044f\u0445, \u0430 \u043f\u043e\u0442\u043e\u043c \u0437\u0430\u0431\u044b\u043b \u0435\u0451 \u0443\u0434\u0430\u043b\u0438\u0442\u044c.  <\/p>\n<pre><code class=\"cpp\">static void bhnd_pmu1_pllinit0(struct bhnd_pmu_softc *sc, uint32_t xtal) {   uint32_t pmuctrl;   ....   \/* Write XtalFreq. Set the divisor also. *\/   pmuctrl = BHND_PMU_READ_4(sc, BHND_PMU_CTRL);   pmuctrl = ~(BHND_PMU_CTRL_ILP_DIV_MASK |               BHND_PMU_CTRL_XTALFREQ_MASK);   pmuctrl |= BHND_PMU_SET_BITS(((xt-&gt;fref + 127) \/ 128) - 1,                                BHND_PMU_CTRL_ILP_DIV);   pmuctrl |= BHND_PMU_SET_BITS(xt-&gt;xf, BHND_PMU_CTRL_XTALFREQ);   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio: <a href=\"http:\/\/www.viva64.com\/ru\/w\/V519\/\">V519<\/a> The &#8216;pmuctrl&#8217; variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 2025, 2026. bhnd_pmu_subr.c 2026<\/p>\n<p>  \u0412\u043c\u0435\u0441\u0442\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <i>|= <\/i> \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 =.<\/p>\n<p>  \u0418 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439, \u043d\u0430 \u0441\u0435\u0433\u043e\u0434\u043d\u044f, \u0434\u0435\u0444\u0435\u043a\u0442 \u044d\u0442\u043e\u0433\u043e \u0442\u0438\u043f\u0430:  <\/p>\n<pre><code class=\"cpp\">void e1000_update_mc_addr_list_vf(struct e1000_hw *hw,   u8 *mc_addr_list, u32 mc_addr_count) {   ....   if (mc_addr_count &gt; 30) {     msgbuf[0] |= E1000_VF_SET_MULTICAST_OVERFLOW;     mc_addr_count = 30;   }    msgbuf[0] = E1000_VF_SET_MULTICAST;   msgbuf[0] |= mc_addr_count &lt;&lt; E1000_VT_MSGINFO_SHIFT;   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio: <a href=\"http:\/\/www.viva64.com\/ru\/w\/V519\/\">V519<\/a> The &#8216;msgbuf[0]&#8217; variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 422, 426. e1000_vf.c 426<\/p>\n<h3>CWE-570: Expression is Always False<\/h3>\n<p>  <\/p>\n<pre><code class=\"cpp\">.... U16  max_ncq_depth; .... SCI_STATUS scif_user_parameters_set(    SCI_CONTROLLER_HANDLE_T   controller,    SCIF_USER_PARAMETERS_T  * scif_parms ) {   ....    if (scif_parms-&gt;sas.max_ncq_depth &lt; 1 &amp;&amp;        scif_parms-&gt;sas.max_ncq_depth &gt; 32)      return SCI_FAILURE_INVALID_PARAMETER_VALUE;   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio: <a href=\"http:\/\/www.viva64.com\/ru\/w\/V547\/\">V547<\/a> Expression is always false. scif_sas_controller.c 531<\/p>\n<p>  \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435 1 \u0438 \u0431\u043e\u043b\u044c\u0448\u0435 32. \u0427\u0442\u043e\u0431\u044b \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d, \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <i>&amp;&amp; <\/i> \u043d\u0430 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <i>||<\/i>.<\/p>\n<p>  \u0418\u0437-\u0437\u0430 \u043e\u0448\u0438\u0431\u043a\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <i>LibAliasSetMode<\/i>:  <\/p>\n<pre><code class=\"cpp\">unsigned int LibAliasSetMode(.....);<\/code><\/pre>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u043e\u0433\u043e \u0442\u0438\u043f\u0430. \u0424\u0443\u043d\u043a\u0446\u0438\u044f, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u043e\u0448\u0438\u0431\u043a\u0438, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 -1. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e -1 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 UINT_MAX.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u044d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f.  <\/p>\n<pre><code class=\"cpp\">static int ng_nat_rcvmsg(node_p node, item_p item, hook_p lasthook) {   ....   if (LibAliasSetMode(priv-&gt;lib,        ng_nat_translate_flags(mode-&gt;flags),       ng_nat_translate_flags(mode-&gt;mask)) &lt; 0) {     error = ENOMEM;     break;   }   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio: <a href=\"http:\/\/www.viva64.com\/ru\/w\/V547\/\">V547<\/a> Expression is always false. Unsigned type value is never &lt; 0. ng_nat.c 374<\/p>\n<p>  \u0415\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043b\u043e\u0436\u043d\u043e. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043c\u0435\u043d\u044c\u0448\u0435 \u043d\u0443\u043b\u044f.<\/p>\n<p>  \u0414\u043b\u044f \u043b\u044e\u0434\u0435\u0439, \u0434\u0435\u043b\u0430\u044e\u0449\u0438\u0445 \u043e\u0431\u0437\u043e\u0440 \u043a\u043e\u0434\u0430, \u0442\u0430\u043a\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u043b\u043e\u0445\u043e \u0437\u0430\u043c\u0435\u0442\u043d\u0430. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 -1. \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0432\u0438\u0434\u0430 <i>if (foo() &lt; 0)<\/i> \u0435\u0441\u0442\u044c. \u0421\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u0432\u0441\u0451 \u0445\u043e\u0440\u043e\u0448\u043e.<\/p>\n<p>  \u041d\u043e \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u0441\u0451 \u043f\u043e\u0440\u0442\u0438\u0442. \u0412\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f 2:<\/p>\n<ul>\n<li>\u0421\u0434\u0435\u043b\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u044f <i>LibAliasSetMode<\/i> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b\u0430 \u0442\u0438\u043f <i>signed <\/i> <i>int<\/i>;<\/li>\n<li>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0451\u043d\u043d\u043e\u0435 \u0435\u0439 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441 <i>UINT_MAX<\/i>.<\/li>\n<\/ul>\n<p>  \u041a\u0430\u043a \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043b\u0443\u0447\u0448\u0435 \u2014 \u0440\u0435\u0448\u0430\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c.<\/p>\n<p>  \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0439 \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0435\u0442, \u0438 \u043a\u043e\u0434 \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u0435\u043d. \u0425\u043e\u0442\u044f \u043a\u0442\u043e \u0437\u043d\u0430\u0435\u0442, \u044f \u043d\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0438 \u043d\u0435 \u0437\u043d\u0430\u044e \u0435\u0433\u043e \u0437\u0430\u043c\u044b\u0441\u0435\u043b.  <\/p>\n<pre><code class=\"cpp\">HAL_BOOL ar9300_reset_tx_queue(struct ath_hal *ah, u_int q) {   u_int32_t cw_min, chan_cw_min, value;   ....   value = (ahp-&gt;ah_beaconInterval * 50 \/ 100)     - ah-&gt;ah_config.ah_additional_swba_backoff     - ah-&gt;ah_config.ah_sw_beacon_response_time     + ah-&gt;ah_config.ah_dma_beacon_response_time;   if (value &lt; 10)     value = 10;   if (value &lt; 0)     value = 10;   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio: <a href=\"http:\/\/www.viva64.com\/ru\/w\/V547\/\">V547<\/a> Expression &#8216;value &lt; 0&#8217; is always false. Unsigned type value is never &lt; 0. ar9300_xmit.c 450<\/p>\n<p>  \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443 \u0432\u043e\u0442 \u0437\u0434\u0435\u0441\u044c:  <\/p>\n<pre><code class=\"cpp\">static void dtrace_debug_output(void) {   ....   if (d-&gt;first &lt; d-&gt;next) {     char *p1 = dtrace_debug_bufr;     count = (uintptr_t) d-&gt;next - (uintptr_t) d-&gt;first;     for (p = d-&gt;first; p &lt; d-&gt;next; p++)       *p1++ = *p;   } else if (d-&gt;next &gt; d-&gt;first) {     char *p1 = dtrace_debug_bufr;     count = (uintptr_t) d-&gt;last - (uintptr_t) d-&gt;first;     for (p = d-&gt;first; p &lt; d-&gt;last; p++)       *p1++ = *p;     count += (uintptr_t) d-&gt;next - (uintptr_t) d-&gt;bufr;     for (p = d-&gt;bufr; p &lt; d-&gt;next; p++)       *p1++ = *p;   }   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio: <a href=\"http:\/\/www.viva64.com\/ru\/w\/V517\/\">V517<\/a> The use of &#8216;if (A) {&#8230;} else if (A) {&#8230;}&#8217; pattern was detected. There is a probability of logical error presence. Check lines: 102, 109. dtrace_debug.c 102<\/p>\n<p>  \u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0432\u043e\u0442 \u043d\u0430 \u044d\u0442\u0438 \u0434\u0432\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0438:  <\/p>\n<pre><code class=\"cpp\">if (d-&gt;first &lt; d-&gt;next) { } else if (d-&gt;next &gt; d-&gt;first) {<\/code><\/pre>\n<p>  \u0425\u043e\u0442\u0435\u043b\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435, \u043d\u043e \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0442\u043e\u0440\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u043b\u043e\u0436\u043d\u044b\u043c.<\/p>\n<h3>CWE-571: Expression is Always True<\/h3>\n<p>  <\/p>\n<pre><code class=\"cpp\">int mfi_tbolt_send_frame(struct mfi_softc *sc, struct mfi_command *cm) {   ....   uint8_t *cdb;   ....   \/* check for inquiry commands coming from CLI *\/   if (cdb[0] != 0x28 || cdb[0] != 0x2A) {     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;     }   }   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio: <a href=\"http:\/\/www.viva64.com\/ru\/w\/V547\/\">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<p>  \u0423\u0441\u043b\u043e\u0432\u0438\u0435 <i>(cdb[0] != 0x28 || cdb[0] != 0x2A)<\/i> \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e. \u0415\u0441\u043b\u0438 \u0431\u0430\u0439\u0442 \u0440\u0430\u0432\u0435\u043d \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e <i>0x28,<\/i> \u0442\u043e \u043e\u043d \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0432\u0435\u043d <i>0x2A<\/i>. \u0418 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u0441\u0442\u0438\u043d\u043d\u043e. <\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0434\u0432\u0430 \u0446\u0438\u043a\u043b\u0430, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u043b\u043e\u0436\u043d\u044b\u043c \u0438 \u043e\u043f\u0430\u0441\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.  <\/p>\n<pre><code class=\"cpp\">static void safe_mcopy(struct mbuf *srcm, struct mbuf *dstm, u_int offset) {   u_int j, dlen, slen;   caddr_t dptr, sptr;    \/*    * Advance src and dst to offset.    *\/   j = offset;   while (j &gt;= 0) {     if (srcm-&gt;m_len &gt; j)       break;     j -= srcm-&gt;m_len;     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) {     if (dstm-&gt;m_len &gt; j)       break;     j -= dstm-&gt;m_len;     dstm = dstm-&gt;m_next;     if (dstm == NULL)       return;   }   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio:<\/p>\n<ul>\n<li>V547 Expression &#8216;j &gt;= 0&#8217; is always true. Unsigned type value is always &gt;= 0. safe.c 1596<\/li>\n<li>V547 Expression &#8216;j &gt;= 0&#8217; is always true. Unsigned type value is always &gt;= 0. safe.c 1608<\/li>\n<\/ul>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <i>j <\/i> \u0438\u043c\u0435\u0435\u0442 \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u0442\u0438\u043f. \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 <i>(j &gt;= 0)<\/i> \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430. \u0421 \u0442\u0435\u043c \u0436\u0435 \u0443\u0441\u043f\u0435\u0445\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c <i>while (true)<\/i>.<\/p>\n<p>  \u042f \u043d\u0435 \u0437\u043d\u0430\u044e, \u043c\u043e\u0436\u0435\u0442 \u043b\u0438 \u044d\u0442\u0430 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0441\u0431\u043e\u0439 \u0438\u043b\u0438 \u0446\u0438\u043a\u043b\u044b \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u0443\u0434\u0443\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u043f\u0440\u0435\u0440\u0432\u0430\u043d\u044b, \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043d\u0430\u043b\u0438\u0447\u0438\u044e \u0432 \u0438\u0445 \u0442\u0435\u043b\u0430\u0445 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 <i>break <\/i> \u0438 <i>return<\/i>. \u041c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u044d\u0442\u043e \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0431\u0430\u0433 \u0438 \u0441\u0442\u043e\u0438\u0442 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0442\u0438\u043f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <i>j <\/i> \u0441 <i>u_int <\/i> \u043d\u0430 <i>int<\/i>.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0434\u0430\u0436\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0437\u0434\u0435\u0441\u044c \u043d\u0435\u0442, \u0442\u043e \u043a\u043e\u0434 \u0441\u0442\u043e\u0438\u0442 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u043d\u0435 \u0441\u0431\u0438\u0432\u0430\u043b \u0441 \u0442\u043e\u043b\u043a\u0443 \u0434\u0440\u0443\u0433\u0438\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0438 \u043d\u0435 \u0441\u0442\u0430\u043b \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043f\u0440\u0438\u0447\u0438\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u043a\u043e\u0433\u0434\u0430 \u043a\u0442\u043e-\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434.<\/p>\n<p>  \u041b\u0438\u0447\u043d\u043e \u043c\u043d\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u0430, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u0430\u044f \u043d\u0438\u0436\u0435. \u042d\u0442\u043e \u043a\u0440\u0430\u0441\u0438\u0432\u0430\u044f \u043e\u043f\u0435\u0447\u0430\u0442\u043a\u0430. \u0425\u043e\u0442\u044f \u043d\u0435\u0442, \u0441\u0442\u043e\u043f, \u044f \u0436\u0435 \u0440\u0435\u0448\u0438\u043b \u0432 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043f\u0440\u043e CWE. \u0418\u0442\u0430\u043a, \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u043c\u0438 \u043a\u0440\u0430\u0441\u0438\u0432\u0430\u044f \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c:  <\/p>\n<pre><code class=\"cpp\">#define OSSA_MPI_ENC_ERR_ILLEGAL_DEK_PARAM            0x2001 #define OSSA_MPI_ERR_DEK_MANAGEMENT_DEK_UNWRAP_FAIL   0x2002  GLOBAL bit32 mpiDekManagementRsp(   agsaRoot_t               *agRoot,   agsaDekManagementRsp_t   *pIomb   ) {   ....   if (status == OSSA_MPI_ENC_ERR_ILLEGAL_DEK_PARAM ||       OSSA_MPI_ERR_DEK_MANAGEMENT_DEK_UNWRAP_FAIL)   {     agEvent.eq = errorQualifier;   }   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio: <a href=\"http:\/\/www.viva64.com\/ru\/w\/V560\/\">V560<\/a> A part of conditional expression is always true: 0x2002. sampirsp.c 7224<\/p>\n<p>  \u0412 \u0443\u0441\u043b\u043e\u0432\u0438\u0438 \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <i>status<\/i>. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u0443\u0441\u0430 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f, \u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u0441\u0442\u0438\u043d\u043d\u043e.<\/p>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435, \u043d\u0435 \u0447\u0438\u0442\u0430\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435, \u043d\u0430\u0439\u0442\u0438 \u043e\u0448\u0438\u0431\u043a\u0443 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <i>ugidfw_rule_valid<\/i> \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e.  <\/p>\n<pre><code class=\"cpp\">static int ugidfw_rule_valid(struct mac_bsdextended_rule *rule) {   if ((rule-&gt;mbr_subject.mbs_flags | MBS_ALL_FLAGS) != MBS_ALL_FLAGS)     return (EINVAL);   if ((rule-&gt;mbr_subject.mbs_neg | MBS_ALL_FLAGS) != MBS_ALL_FLAGS)     return (EINVAL);   if ((rule-&gt;mbr_object.mbo_flags | MBO_ALL_FLAGS) != MBO_ALL_FLAGS)     return (EINVAL);   if ((rule-&gt;mbr_object.mbo_neg | MBO_ALL_FLAGS) != MBO_ALL_FLAGS)     return (EINVAL);   if ((rule-&gt;mbr_object.mbo_neg | MBO_TYPE_DEFINED) &amp;&amp;        (rule-&gt;mbr_object.mbo_type | MBO_ALL_TYPE) != MBO_ALL_TYPE)     return (EINVAL);   if ((rule-&gt;mbr_mode | MBI_ALLPERM) != MBI_ALLPERM)     return (EINVAL);   return (0); }<\/code><\/pre>\n<p>  \u0422\u044f\u0436\u0435\u043b\u043e?<\/p>\n<p>  \u0414\u0443\u043c\u0430\u044e, \u0434\u0430. \u0412\u043e\u0442 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u044b \u0442\u0430\u043a \u0432\u0430\u0436\u043d\u044b. \u041e\u043d\u0438 \u043d\u0435 \u0437\u0435\u0432\u0430\u044e\u0442 \u0438 \u043d\u0435 \u0443\u0441\u0442\u0430\u044e\u0442 \u043f\u0440\u0438 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/p>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio: <a href=\"http:\/\/www.viva64.com\/ru\/w\/V617\/\">V617<\/a> Consider inspecting the condition. The &#8216;0x00000080&#8217; argument of the &#8216;|&#8217; bitwise operation contains a non-zero value. mac_bsdextended.c 128<\/p>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u0432\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u043c\u0430\u043a\u0440\u043e\u0441 <i>MBO_TYPE_DEFINED<\/i>:  <\/p>\n<pre><code class=\"cpp\">#define  MBO_TYPE_DEFINED 0x00000080<\/code><\/pre>\n<p>  \u0410 \u0442\u0435\u043f\u0435\u0440\u044c, \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u043e\u0442 \u0441\u044e\u0434\u0430:  <\/p>\n<pre><code class=\"cpp\">(rule-&gt;mbr_object.mbo_neg | MBO_TYPE_DEFINED)<\/code><\/pre>\n<p>  \u0427\u0430\u0441\u0442\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u0441\u0442\u0438\u043d\u0430. \u0415\u0441\u043b\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u043e\u0434, \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u0440\u044f\u0434\u043e\u043c, \u0442\u043e \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c, \u0447\u0442\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u0445\u043e\u0442\u0435\u043b\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"cpp\">(rule-&gt;mbr_object.mbo_neg | MBO_TYPE_DEFINED) != MBO_TYPE_DEFINED<\/code><\/pre>\n<p>  \u0427\u0442\u043e-\u0442\u043e \u0441\u0442\u0430\u0442\u044c\u044f \u0432\u0441\u0451 \u043d\u0435 \u0445\u043e\u0447\u0435\u0442 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f. \u041f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c\u0441\u044f \u0438 \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043e\u0432 \u043a\u043e\u0434\u0430. \u0422\u0430\u043a \u0447\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u043d\u0430\u0439\u0442\u0435, \u0447\u0442\u043e \u0432\u0438\u0436\u0443 \u0435\u0449\u0451 \u0447\u0435\u0442\u044b\u0440\u0435 CWE-571:<\/p>\n<ul>\n<li>V560 A part of conditional expression is always true: 0x7dac. t4_main.c 8001<\/li>\n<li>V547 Expression &#8216;cfgflags &gt;= 0 || cfgflags &lt;= 3&#8217; is always true. hwpmc_piv.c 812<\/li>\n<li>V547 Expression &#8216;cfgflags &gt;= 0 || cfgflags &lt;= 3&#8217; is always true. hwpmc_piv.c 838<\/li>\n<li>V501 There are identical sub-expressions &#8216;G_Addr-&gt;g_addr.s_addr&#8217; to the left and to the right of the &#8216;==&#8217; operator. alias_sctp.c 2132<\/li>\n<\/ul>\n<p>  <\/p>\n<h3>CWE-14: Compiler Removal of Code to Clear Buffers<\/h3>\n<p>  <\/p>\n<pre><code class=\"cpp\">int mlx5_core_create_qp(struct mlx5_core_dev *dev,       struct mlx5_core_qp *qp,       struct mlx5_create_qp_mbox_in *in,       int inlen) {   ....   struct mlx5_destroy_qp_mbox_out dout;   .... err_cmd:   memset(&amp;din, 0, sizeof(din));   memset(&amp;dout, 0, sizeof(dout));   din.hdr.opcode = cpu_to_be16(MLX5_CMD_OP_DESTROY_QP);   din.qpn = cpu_to_be32(qp-&gt;qpn);   mlx5_cmd_exec(dev, &amp;din, sizeof(din), &amp;out, sizeof(dout));    return err; }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio: <a href=\"http:\/\/www.viva64.com\/ru\/w\/V597\/\">V597<\/a> The compiler could delete the &#8216;memset&#8217; function call, which is used to flush &#8216;dout&#8217; object. The memset_s() function should be used to erase the private data. mlx5_qp.c 159<\/p>\n<p>  \u0425\u043e\u0442\u0435\u043b\u0438 \u043e\u0431\u043d\u0443\u043b\u0438\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 <i>dout<\/i>, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0443\u044e \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u041e\u0448\u0438\u0431\u043a\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u044d\u0442\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f. \u0422\u043e\u0447\u043d\u0435\u0435, \u043e\u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u043e\u0442 \u0437\u0434\u0435\u0441\u044c <i>sizeof(dout)<\/i>, \u043d\u043e \u044d\u0442\u043e \u043d\u0435 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0443\u0434\u0430\u043b\u0438\u0442 \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <i>memset<\/i>.<\/p>\n<p>  \u0415\u0449\u0451 \u043e\u0434\u043d\u043e \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u043e\u0435 \u043e\u0431\u043d\u0443\u043b\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0437\u0434\u0435\u0441\u044c: <a href=\"http:\/\/www.viva64.com\/ru\/w\/V597\/\">V597<\/a> The compiler could delete the &#8216;memset&#8217; function call, which is used to flush &#8216;dout&#8217; object. The memset_s() function should be used to erase the private data. mlx5_qp.c 323<\/p>\n<p>  \u041a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u044f \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e \u043e\u0448\u0438\u0431\u043a\u0443 \u043e\u0431\u043d\u0443\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043a\u0442\u043e-\u0442\u043e, \u043a\u0442\u043e \u043f\u0438\u0448\u0435\u0442 \u043c\u043d\u0435 \u043e\u0434\u043d\u043e \u0438\u0437 \u0434\u0432\u0443\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439:<\/p>\n<ul>\n<li>\u0411\u044b\u0442\u044c \u0442\u0430\u043a\u043e\u0433\u043e \u043d\u0435 \u043c\u043e\u0436\u0435\u0442, \u0412\u044b \u0432\u0440\u0451\u0442\u0435. \u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043e\u0441\u0442\u0430\u0432\u0438\u0442 \u0432\u044b\u0437\u043e\u0432 <i>memset <\/i> \u043d\u0430 \u0441\u0432\u043e\u0451\u043c \u043c\u0435\u0441\u0442\u0435.<\/li>\n<li>\u042d\u0442\u043e \u043e\u0448\u0438\u0431\u043a\u0430 \u0432 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0435, \u0430 \u043d\u0435 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435. \u041d\u0430\u0434\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0430\u0432\u0442\u043e\u0440\u0430\u043c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430.<\/li>\n<\/ul>\n<p>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u044f\u0441\u043d\u044e. \u0421\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0434\u0430\u043b\u044f\u044e\u0442 \u0432\u044b\u0437\u043e\u0432\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <i>memset <\/i> \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438. \u0418 \u044d\u0442\u043e \u043d\u0435 \u043e\u0448\u0438\u0431\u043a\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u044d\u0442\u0430 \u0442\u0435\u043c\u0430 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0438 <a href=\"https:\/\/www.viva64.com\/ru\/w\/V597\/\">V597<\/a>.<\/p>\n<h3>CWE-561: Dead Code<\/h3>\n<p>  <\/p>\n<pre><code class=\"cpp\">static int wi_pci_resume(device_t dev) {   struct wi_softc  *sc = device_get_softc(dev);   struct ieee80211com *ic = &amp;sc-&gt;sc_ic;    WI_LOCK(sc);   if (sc-&gt;wi_bus_type != WI_BUS_PCI_NATIVE) {     return (0);                                 \/\/ &lt;=     WI_UNLOCK(sc);                              \/\/ &lt;=   }   if (ic-&gt;ic_nrunning &gt; 0)     wi_init(sc);   WI_UNLOCK(sc);   return (0); }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio: <a href=\"http:\/\/www.viva64.com\/ru\/w\/V779\/\">V779<\/a> Unreachable code detected. It is possible that an error is present. if_wi_pci.c 258<\/p>\n<p>  \u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u0432 \u0442\u0435\u043a\u0441\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <i>return<\/i>, \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u0440\u0430\u0437\u043b\u043e\u0447\u0438\u0442\u044c \u043d\u0435\u043a\u0438\u0439 \u0440\u0435\u0441\u0443\u0440\u0441.<\/p>\n<h2>\u041f\u0440\u043e\u0447\u0435\u0435<\/h2>\n<p>  \u042f \u043d\u0430\u0448\u0435\u043b \u0435\u0449\u0451 \u0434\u0435\u0441\u044f\u0442\u043e\u043a \u0437\u0430\u043d\u044f\u0442\u043d\u044b\u0445 \u0431\u0430\u0433\u043e\u0432 \u0432 \u043a\u043e\u0434\u0435. \u042f \u043d\u0435 \u0437\u043d\u0430\u044e, \u043a\u0430\u043a \u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e CWE, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435 \u0431\u0443\u0434\u0443 \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0438\u0445 \u0437\u0430 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0438, \u043d\u043e \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043e\u043f\u0438\u0448\u0443. \u0412\u0435\u0434\u044c \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442 \u0442\u043e\u0433\u043e, \u043c\u043e\u0433\u0443 \u044f \u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u043b\u0438 \u043d\u0435\u0442, \u043e\u0448\u0438\u0431\u043a\u0438 \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438.  <\/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)     vme-&gt;eflags |= MAP_ENTRY_COW | MAP_ENTRY_NEEDS_COPY;   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio: <a href=\"http:\/\/www.viva64.com\/ru\/w\/V646\/\">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<p>  \u041c\u043d\u0435, \u043a\u0430\u043a \u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0443, \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u0437\u0430\u0431\u044b\u043b\u0438 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <i>else<\/i>.<\/p>\n<p>  \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e:<\/p>\n<ul>\n<li>V646 Consider inspecting the application&#8217;s logic. It&#8217;s possible that &#8216;else&#8217; keyword is missing. if_em.c 1905<\/li>\n<li>V646 Consider inspecting the application&#8217;s logic. It&#8217;s possible that &#8216;else&#8217; keyword is missing. if_em.c 3200<\/li>\n<\/ul>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u043e\u0433\u043e Copy-Paste. \u0412\u0438\u0434\u0438\u0442\u0435 \u043e\u0448\u0438\u0431\u043a\u0443?  <\/p>\n<pre><code class=\"cpp\">static int cyapa_raw_input(struct cyapa_softc *sc,                 struct cyapa_regs *regs, int freq) {   ....   if (sc-&gt;delta_x &gt; sc-&gt;cap_resx)     sc-&gt;delta_x = sc-&gt;cap_resx;   if (sc-&gt;delta_x &lt; -sc-&gt;cap_resx)     sc-&gt;delta_x = -sc-&gt;cap_resx;   if (sc-&gt;delta_y &gt; sc-&gt;cap_resx)     sc-&gt;delta_y = sc-&gt;cap_resy;   if (sc-&gt;delta_y &lt; -sc-&gt;cap_resy)      sc-&gt;delta_y = -sc-&gt;cap_resy;   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio: <a href=\"http:\/\/www.viva64.com\/ru\/w\/V778\/\">V778<\/a> Two similar code fragments were found. Perhaps, this is a typo and &#8216;cap_resy&#8217; variable should be used instead of &#8216;cap_resx&#8217;. cyapa.c 1458<\/p>\n<p>  \u0412\u043e\u0442 \u043e\u043d\u0430:  <\/p>\n<pre><code class=\"cpp\">if (sc-&gt;delta_y &gt; sc-&gt;cap_resx)<\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0437\u0430\u0431\u044b\u043b\u0438 \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c <i>cap_resx<\/i> \u043d\u0430 <i>cap_resy<\/i>.  <\/p>\n<pre><code class=\"cpp\">static int linux_msqid_pushdown(l_int ver, struct l_msqid64_ds *linux_msqid64,                      caddr_t uaddr) {   ....   if (linux_msqid64-&gt;msg_qnum &gt; USHRT_MAX)     linux_msqid.msg_qnum = linux_msqid64-&gt;msg_qnum;   else     linux_msqid.msg_qnum = linux_msqid64-&gt;msg_qnum;   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio: <a href=\"http:\/\/www.viva64.com\/ru\/w\/V523\/\">V523<\/a> The &#8216;then&#8217; statement is equivalent to the &#8216;else&#8217; statement. linux_ipc.c 353<\/p>\n<p>  \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e:<\/p>\n<ul>\n<li>V523 The &#8216;then&#8217; statement is equivalent to the &#8216;else&#8217; statement. linux_ipc.c 357<\/li>\n<li>V523 The &#8216;then&#8217; statement is equivalent to the &#8216;else&#8217; statement. nfs_clvnops.c 2877<\/li>\n<li>V523 The &#8216;then&#8217; statement is equivalent to the &#8216;else&#8217; statement. smsatcb.c 5793<\/li>\n<li>V523 The &#8216;then&#8217; statement is equivalent to the &#8216;else&#8217; statement. arcmsr.c 4182<\/li>\n<li>V523 The &#8216;then&#8217; statement is equivalent to the &#8216;else&#8217; statement. bxe.c 3812<\/li>\n<\/ul>\n<p>  \u041d\u0430\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u043a, \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <i>strncmp<\/i>:  <\/p>\n<pre><code class=\"cpp\">int ipf_p_irc_complete(ircp, buf, len)   ircinfo_t *ircp;   char *buf;   size_t len; {   ....   if (strncmp(s, &quot;PRIVMSG &quot;, 8))     return 0;   ....   if (strncmp(s, &quot;\\001DCC &quot;, 4))  \/\/ &lt;=     return 0;   .... }<\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 PVS-Studio: <a href=\"http:\/\/www.viva64.com\/ru\/w\/V666\/\">V666<\/a> Consider inspecting third argument of the function &#8216;strncmp&#8217;. It is possible that the value does not correspond with the length of a string which was passed with the second argument. ip_irc_pxy.c 140<\/p>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f, \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u043b\u0438 \u0441\u0442\u0440\u043e\u043a\u0430 \u0441 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u00abPRIVMSG \u00bb. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0431\u0435\u043b.<\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0438\u0434\u0451\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430, \u0447\u0442\u043e \u0441\u0442\u0440\u043e\u043a\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 &quot;\\001DCC &quot;. \u041d\u043e \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435, \u0435\u0441\u043b\u0438 \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u0435\u043b, \u043d\u0435 4, \u0430 5 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432. \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \\001 \u2014 \u044d\u0442\u043e \u043e\u0434\u0438\u043d \u0441\u0438\u043c\u0432\u043e\u043b.<\/p>\n<h2>\u041f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f PVS-Studio<\/h2>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/125\/05c\/ed7\/12505ced7a1dc169e6f5fd260a728ecc.png\" alt=\"\u041f\u043e\u0440\u0430 \u043f\u043e\u043a\u0443\u043f\u0430\u0442\u044c PVS-Studio\"\/><\/p>\n<p>  \u041a\u043e\u0434 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<\/a> \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Coverity (\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u0442\u0430\u043b \u0447\u0430\u0441\u0442\u044c\u044e Synopsys). \u042d\u0442\u043e \u043d\u0435 \u043f\u043e\u043c\u0435\u0448\u0430\u043b\u043e \u043c\u043d\u0435 \u0441\u0435\u0441\u0442\u044c \u0432\u0435\u0447\u0435\u0440\u043e\u043c \u043d\u0430 \u0441\u0442\u0443\u043b, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c PVS-Studio \u0438 \u043d\u0430\u0439\u0442\u0438 \u0437\u0430 \u0432\u0435\u0447\u0435\u0440 56 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0438 \u0435\u0449\u0451 10 \u0431\u0430\u0433\u043e\u0432. \u041f\u0440\u0438\u0447\u0435\u043c \u044f \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0435 \u0441\u0442\u0430\u0432\u0438\u043b \u0446\u0435\u043b\u044c \u043d\u0430\u0439\u0442\u0438 \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0448\u0438\u0431\u043e\u043a. \u041e \u0447\u0435\u043c \u044d\u0442\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442? \u041e \u0442\u043e\u043c, \u0447\u0442\u043e PVS-Studio \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0435\u0440\u044c\u0451\u0437\u043d\u044b\u043c \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043e\u043c Coverity \u0432 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u0445. \u0414\u0430 \u0435\u0449\u0451 PVS-Studio \u0438 \u0441\u0442\u043e\u0438\u0442 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0434\u0435\u0448\u0435\u0432\u043b\u0435.<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  \u0422\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u044e, \u0447\u0442\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u043e\u0442 \u0441\u043b\u0443\u0447\u0430\u044f \u043a \u0441\u043b\u0443\u0447\u0430\u044e, \u0430 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e. \u0415\u0434\u0438\u043d\u0438\u0447\u043d\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430, \u043f\u043e\u0434\u043e\u0431\u043d\u0430\u044f \u0442\u043e\u0439, \u0447\u0442\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435, \u043c\u043e\u0436\u0435\u0442 \u0441\u043b\u0443\u0436\u0438\u0442\u044c \u0445\u043e\u0440\u043e\u0448\u0435\u0439 \u0440\u0435\u043a\u043b\u0430\u043c\u043e\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430, \u043d\u043e \u043d\u0435 \u043f\u0440\u0438\u043d\u0435\u0441\u0451\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u043c\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043f\u043e\u043b\u044c\u0437\u044b. \u0412\u0441\u044f \u0441\u0443\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430, \u0447\u0442\u043e \u043c\u043d\u043e\u0433\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0440\u0430\u043d\u043d\u0435\u043c \u044d\u0442\u0430\u043f\u0435. \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u0442\u0430\u043a \u043b\u0435\u0433\u0447\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u0447\u0438\u0441\u0442\u044b\u043c \u0438 \u043d\u0435 \u0438\u0441\u043a\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u0441\u0440\u0435\u0434\u0438 \u0441\u043e\u0442\u0435\u043d \u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0439. \u0417\u0434\u0435\u0441\u044c \u043f\u043e\u043b\u043d\u0430\u044f \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u044f \u0441 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f\u043c\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430.<\/p>\n<p>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0445\u0432\u0430\u0442\u0438\u0442 \u0447\u0438\u0442\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u0438, \u043f\u043e\u0440\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c PVS-Studio \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e, \u043d\u0435 \u043e\u0442\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044f <a href=\"https:\/\/www.viva64.com\/ru\/pvs-studio-download\/\">\u0441\u043a\u0430\u0447\u0430\u0442\u044c PVS-Studio<\/a> \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0441\u0432\u043e\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u044b. \u041f\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u0430\u043c \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043f\u0438\u0448\u0438\u0442\u0435 \u043d\u0430 \u043f\u043e\u0447\u0442\u0443 support[@]viva64.com \u0438\u043b\u0438 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435\u0441\u044c <a href=\"https:\/\/www.viva64.com\/ru\/about-feedback\/\">\u0444\u043e\u0440\u043c\u043e\u0439 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0439 \u0441\u0432\u044f\u0437\u0438<\/a>.<\/p>\n<p>  <a href=\"http:\/\/www.viva64.com\/en\/b\/0496\/\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/8d2\/41b\/5bf\/8d241b5bf34747169141ed7c1997143b.png\" \/><\/div>\n<p><\/a><\/p>\n<p>  \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: Andrey Karpov. <a href=\"http:\/\/www.viva64.com\/en\/b\/0496\/\">How to find 56 potential vulnerabilities in FreeBSD code in one evening<\/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<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\/325780\/\"> https:\/\/habrahabr.ru\/post\/325780\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/5b6\/5d4\/195\/5b65d4195da88c1044587655b7c725d9.png\" alt=\"FreeBSD, CWE\"\/><br \/>  \u041f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u043d\u043e\u0432\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 FreeBSD \u0438 \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u0434\u0430\u0436\u0435 \u0432 \u0442\u0430\u043a\u0438\u0445 \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u044b\u0445 \u0438 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 PVS-Studio \u043b\u0435\u0433\u043a\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u043e\u0448\u0438\u0431\u043a\u0438. \u0412 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u044f \u0440\u0435\u0448\u0438\u043b \u0432\u0437\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u043d\u0430 \u043f\u043e\u0438\u0441\u043a \u043e\u0448\u0438\u0431\u043e\u043a \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0435\u0439. \u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 PVS-Studio \u0432\u0441\u0435\u0433\u0434\u0430 \u0443\u043c\u0435\u043b \u0432\u044b\u044f\u0432\u043b\u044f\u0442\u044c \u0434\u0435\u0444\u0435\u043a\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0430\u0442\u0430\u043a\u0438. \u041d\u043e \u043c\u044b \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0430\u043a\u0446\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u043d\u0430 \u044d\u0442\u043e\u043c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0438 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u043a\u0430\u043a \u043e\u043f\u0435\u0447\u0430\u0442\u043a\u0438, \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u044f \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u043e\u0433\u043e Copy-Paste \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435, \u0438 \u043d\u0435 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0438\u0445, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e CWE. \u0421\u0435\u0439\u0447\u0430\u0441 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u0438 \u043e \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438, \u0438 \u043e\u0431 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044f\u0445, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u044e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0432\u0430\u0448\u0435 \u0432\u043e\u0441\u043f\u0440\u0438\u044f\u0442\u0438\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430. PVS-Studio \u2014 \u044d\u0442\u043e \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0438\u0441\u043a \u0431\u0430\u0433\u043e\u0432, \u043d\u043e \u0435\u0449\u0451 \u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u043f\u043e\u0432\u044b\u0448\u0430\u044e\u0449\u0438\u0439 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0434\u0430.  <\/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-284524","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/284524","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=284524"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/284524\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=284524"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=284524"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=284524"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}