public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Martin Walch <walch.martin@web.de>
To: Paul Bolle <pebolle@tiscali.nl>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [kconfig] results of some syntactical checks
Date: Wed, 17 Jul 2013 15:07:05 +0200	[thread overview]
Message-ID: <98150748.1bixKSE5hB@tacticalops> (raw)
In-Reply-To: <1374042658.26384.31.camel@x61.thuisdomein>

[-- Attachment #1: Type: text/plain, Size: 2825 bytes --]

On Wednesday 17 July 2013 01:18:00 Paul Bolle wrote:
> On Wed, 2013-07-17 at 00:34 +0200, Martin Walch wrote:
> > As I am working on yet another project for analyzing LKC's input files, I
> > have some intermediate results from simple syntactical checks.
> 
> Naive question: LKC?

Sorry, I thought the abbreviation of the kconfig system "LinuxKernelConf" was 
common.

> > The results below are an excerpt from a run against tche current master.
> 
> One thing I noticed is that it is practical to be able to parse
> arbitrary tags (commits) in the git tree. So you can quickly parse a
> tree you don't actually have checked out in git. But perhaps your
> checker also does that.

Actually no, it does not. So far, a tree has to be checked out and a branch 
has to be manually selected.

> > Actually defined symbols with dangerous names: 2
> > 
> >   8260 at
> >   
> >     arch/powerpc/platforms/82xx/Kconfig:55:0
> >   
> >   8272 at
> >   
> >     arch/powerpc/platforms/82xx/Kconfig:64:0
> 
> I've wondered for some time what happens when one uses either of these
> numbers as the value for an "int" Kconfig symbol. I've never tried.

I would not expect anything bad to happen when the user manually assigns a 
value like 8260. However, it can break a range value like this:

config FOO
        int "FOO"
        range 8260 8272

On ARCH=powerpc, this will effectively make LKC print a warning "range is 
invalid" and pin down the value of FOO to 0.

Similar problems occur with default values:

config FOO
        int "FOO" if n
        default 8260

This will raise a warning "'FOO': number is invalid" and default FOO to 0.

No warning will show up if the symbol with the integer name would be actually 
an int:

config 4711
        int "4711"

config FOO
        int "FOO" if n
        default 4711

In this case, FOO will be set to whatever 4711 is set to.

All this can be avoided by quoting values, i. e.

	range "8260" "8272"

and

        default "4711"

Also, avoiding integers (and hex values) as symbol names looks like a 
reasonable idea.

> >   Symbol: PLATFORM_MICROBLAZE_AUTO at
> >   
> >     arch/microblaze/platform/Kconfig.platform:10:0
> 
> This is a default of a "choice". There used to be quite a lot of invalid
> "choice" defaults, so I stopped checking those. (But I didn't bother to
> look how my local script now handles these.) In practice these are
> treated as "no default", aren't they?

As far as I can tell, yes. Such a default line will be basically just ignored.


On Wednesday 17 July 2013 08:30:58 Paul Bolle wrote:
> > My script currently finds 28 undefined symbols. That equals this result
> > (given you have 2 false positive and 1 undefined choice default.)
> 
> So those 2 were actually correct positives.

I am glad that our results match. So they are presumably correct.
-- 

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-16 22:34 [kconfig] results of some syntactical checks Martin Walch
2013-07-16 23:18 ` Paul Bolle
2013-07-17  6:30   ` Paul Bolle
2013-07-17 13:07     ` Martin Walch [this message]
2013-07-18 12:17       ` Paul Bolle

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=98150748.1bixKSE5hB@tacticalops \
    --to=walch.martin@web.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pebolle@tiscali.nl \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox