All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
To: Jeff King <peff@peff.net>
Cc: Junio C Hamano <gitster@pobox.com>, Johannes Sixt <j6t@kdbg.org>,
	GIT Mailing-list <git@vger.kernel.org>
Subject: Re: [PATCH] Fix some sparse warnings
Date: Sat, 20 Jul 2013 20:26:27 +0100	[thread overview]
Message-ID: <51EAE463.4010705@ramsay1.demon.co.uk> (raw)
In-Reply-To: <20130718203640.GB15735@sigill.intra.peff.net>

Jeff King wrote:
> On Thu, Jul 18, 2013 at 09:25:50PM +0100, Ramsay Jones wrote:
> 
>> Sparse issues some "Using plain integer as NULL pointer" warnings.
>> Each warning relates to the use of an '{0}' initialiser expression
>> in the declaration of an 'struct object_info'. The first field of
>> this structure has pointer type. Thus, in order to suppress these
>> warnings, we replace the initialiser expression with '{NULL}'.
>>
>> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
> 
> Acked-by: Jeff King <peff@peff.net>
> 
> I thought at first we would need one more for the new callsite I added
> in my series, but we use memset() in that instance, so it is fine.

On an almost unrelated note ... I am now getting the following sparse
warnings:

    pack-revindex.c:105:23: warning: memset with byte count of 262144

This is a little annoying, since there is no way to turn this off. :(
(which I consider a bug in sparse).

Sparse has special-case code to check calls to memset(), memcpy(),
copy_to_user() and copy_from_user(). The code that checks the byte
count argument looks like:

static void check_byte_count(struct instruction *insn, pseudo_t count)
{
        if (!count)
                return;
        if (count->type == PSEUDO_VAL) {
                long long val = count->value;
                if (val <= 0 || val > 100000)
                        warning(insn->pos, "%s with byte count of %lld",
                                show_ident(insn->func->sym->ident), val);
                return;
        }
        /* OK, we could try to do the range analysis here */
}

I will just ignore this for now. ;-)

ATB,
Ramsay Jones

  reply	other threads:[~2013-07-21 13:06 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-18 20:25 [PATCH] Fix some sparse warnings Ramsay Jones
2013-07-18 20:36 ` Jeff King
2013-07-20 19:26   ` Ramsay Jones [this message]
2013-07-21 17:39 ` Jonathan Nieder
2013-07-21 20:58   ` Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2013-07-15 17:31 Ramsay Jones
2013-07-16  5:57 ` Johannes Sixt
2013-07-16  6:21   ` Jeff King
2013-07-16 20:53     ` Philip Oakley
2013-07-16 21:18       ` Stefan Beller
2013-07-16 22:18         ` Philip Oakley
2013-07-17  5:47         ` Johannes Sixt
2013-07-17 22:08       ` Stefan Beller
2013-07-17 22:16         ` Stefan Beller
2013-07-17 23:22         ` Junio C Hamano
2013-07-18 17:58     ` Ramsay Jones
2008-04-25 16:34 Atsushi Nemoto
2008-04-27 17:33 ` Ralf Baechle
2005-10-02 16:16 Atsushi Nemoto
2005-10-03 10:40 ` Ralf Baechle

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51EAE463.4010705@ramsay1.demon.co.uk \
    --to=ramsay@ramsay1.demon.co.uk \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.