From: Duy Nguyen <pclouds@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Fwd: New Defects reported by Coverity Scan for git
Date: Fri, 31 Jul 2015 18:24:13 +0700 [thread overview]
Message-ID: <CACsJy8AfYHOCBdSNyBZP0CdYJGkXbipn0t7E_C8j7c25LET4Qg@mail.gmail.com> (raw)
In-Reply-To: <55bb53d17f78c_2d71521318537c@scan.mail>
Jeff, I suppose you are the admin of git on scan.coverity, or knows
him/her, perhaps we can add a model for xmalloc to suppress these
"null pointer deferences" reports? We are sure xmalloc() never returns
NULL. Qemu did it [1] and it looks simple.. I think something like
this would do
void *xmalloc(size_t size)
{
void *mem = malloc(size);
if (!mem) __coverity_panic__();
return mem;
}
[1] http://git.qemu.org/?p=qemu.git;a=blob;f=scripts/coverity-model.c;h=4c99a85cfc292caa9edd9d041e2683ee53490a8d;hb=e40cdb0e6efb795e4d19368987d53e3e4ae19cf7#l104
---------- Forwarded message ----------
From: <scan-admin@coverity.com>
Date: Fri, Jul 31, 2015 at 5:54 PM
Subject: New Defects reported by Coverity Scan for git
To: pclouds@gmail.com
_______________________________________________________________________________________________________
*** CID 1313836: Null pointer dereferences (FORWARD_NULL)
/rerere.c: 150 in find_rerere_dir()
144 return NULL; /* BUG */
145 pos = sha1_pos(sha1, rerere_dir, rerere_dir_nr,
rerere_dir_sha1);
146 if (pos < 0) {
147 rr_dir = xmalloc(sizeof(*rr_dir));
148 hashcpy(rr_dir->sha1, sha1);
149 rr_dir->status_nr = rr_dir->status_alloc = 0;
>>> CID 1313836: Null pointer dereferences (FORWARD_NULL)
>>> Assigning: "rr_dir->status" = "NULL".
150 rr_dir->status = NULL;
151 pos = -1 - pos;
152
153 /* Make sure the array is big enough ... */
154 ALLOC_GROW(rerere_dir, rerere_dir_nr + 1,
rerere_dir_alloc);
155 /* ... and add it in. */
** CID 1313835: Null pointer dereferences (FORWARD_NULL)
/builtin/fetch.c: 795 in prune_refs()
--
Duy
next parent reply other threads:[~2015-07-31 11:24 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <55bb53d17f78c_2d71521318537c@scan.mail>
2015-07-31 11:24 ` Duy Nguyen [this message]
2015-07-31 16:11 ` New Defects reported by Coverity Scan for git Stefan Beller
2015-07-31 16:58 ` Stefan Beller
2018-03-26 23:39 Fwd: " Stefan Beller
2018-03-27 10:38 ` Jeff Hostetler
[not found] <596ddaa620821_77f83e7330107c4@ss1435.mail>
2017-07-18 16:59 ` Stefan Beller
2017-07-18 17:23 ` Junio C Hamano
2017-07-18 17:41 ` Stefan Beller
2017-07-18 17:55 ` Junio C Hamano
2017-07-18 18:00 ` Brandon Williams
2017-07-18 18:06 ` Stefan Beller
2017-07-20 20:32 ` René Scharfe
2017-07-20 21:52 ` Junio C Hamano
[not found] <580893d5a4736_4ed37b53181837@ss1435.mail>
2016-10-20 17:05 ` Stefan Beller
2016-10-20 17:50 ` Junio C Hamano
2016-10-20 17:58 ` Stefan Beller
2016-10-20 18:05 ` Junio C Hamano
2016-10-20 18:13 ` Stefan Beller
2016-10-20 21:42 ` Jeff King
2016-10-20 22:07 ` Junio C Hamano
2016-10-20 21:40 ` Jeff King
[not found] <558151df465a5_4fafe3b3182568a@scan.mail>
2015-06-17 13:54 ` Duy Nguyen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CACsJy8AfYHOCBdSNyBZP0CdYJGkXbipn0t7E_C8j7c25LET4Qg@mail.gmail.com \
--to=pclouds@gmail.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).