[systemd-devel] PATCH: fix sparse warnings

Frederic Crozat fcrozat at suse.com
Mon Mar 5 06:21:12 PST 2012


Le lundi 05 mars 2012 à 15:10 +0100, Lennart Poettering a écrit :
> On Wed, 29.02.12 18:33, Frederic Crozat (fcrozat at suse.com) wrote:
> 
> > Le mercredi 29 février 2012 à 17:04 +0000, Frederic Crozat a écrit :
> > > Hi, 
> > > 
> > > while trying to use sparse to detect potential endianness errors in
> > > journald code (apparently, we can't use it for that), I found some other
> > > warnings with sparse.
> > > 
> > > Attached patch fixes those (mostly missing static call, 0 vs NULL and
> > > macros redefinition).
> > 
> > Better with patch attached ;)
> 
> > >From d07e3f17e21ad4b200d0e076e0f49a3f8e91fae9 Mon Sep 17 00:00:00 2001
> > From: Frederic Crozat <fcrozat at suse.com>
> > Date: Wed, 29 Feb 2012 14:42:49 +0100
> > Subject: [PATCH] fix sparse warnings
> 
> Looks all good. Applied.
> 
> I have little experience with sparse, but iirc it knows decorators for
> variables for le/be, right? Is this something we might want to use in
> the journal to avoid LE/BE issues like those you tracked down?

Well, I spend almost a day trying to get sparse to spot endian-ness
errors but couldn't get it to work properly :(

The idea would be to replace any uint64_t type with __le64
(from /usr/include/linux/types.h) in data structures written on disk and
make sure only function returning __le64 are used to modify those
variables. Unfortunately, I wasn't able to teach sparse about htole64 /
le64toh. 

Help welcome ;)

-- 
Frederic Crozat <fcrozat at suse.com>
SUSE



More information about the systemd-devel mailing list