Re: [LTP] [PATCH] Annotate tst_*() helpers with __attribute__ ((format (printf, M, N))) (was: Re: [PATCH] quotactl01: Fix tst_resm () format causing crash )

Subrata Modak
2009-08-28T10:11:17Z

On Fri, 2009-08-28 at 05:14 -0400, Mike Frysinger wrote:
> On Friday 28 August 2009 04:38:17 Subrata Modak wrote:
> > On Fri, 2009-08-28 at 11:38 +0530, Subrata Modak wrote:
> > > On Thu, 2009-08-27 at 17:29 +0200, Geert Uytterhoeven wrote:
> > > > On Thu, 27 Aug 2009, Geert Uytterhoeven wrote:
> > > > > When the quotactl syscall fails, quotactl01 crashes with a
> > > > > segmentation fault due to an incorrect printf()-style format.
> > > >
> > > > This bug encouraged me to add annotations to the test helpers that take
> > > > printf()-style formats, cfr. the patch below.
> > > >
> > > > It causes a massive amount of compiler warnings, most of them caused by
> > > > TEST_ERRNO being long. According to CVS history, both TEST_RETURN and
> > > > TEST_ERRNO have been changed from int to long to accomodate 64-bit
> > > > platforms, but to me the change of TEST_ERRNO looks bogus.
> > > > As errno is int according to C99, TEST_ERRNO should actually be int
> > > > too, right?
> > > >
> > > > Note that there are also a few other cases where integers are used on
> > > > pointer type format specifiers. These will cause crashes when the code
> > > > path is executed.
> > > >
> > > > >From 601578f79c05779acefe023fd499726d9fe4ce03 Mon Sep 17 00:00:00 2001
> > > >
> > > > From: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
> > > > Date: Thu, 27 Aug 2009 17:08:18 +0200
> > > > Subject: [PATCH] Annotate tst_*() helpers with __attribute__ ((format
> > > > (printf, M, N)))
> > > >
> > > > Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
> > >
> > > Ok. Thanks.
> >
> > Sorry. I need to revert this as it generates a huge set of warning for
> > all the tests compiled. It should not only get fixed at test.h, but also
> > in all tests that uses the tst_* family of functions, which obviously is
> > too big to fix.
>
> nothing is too big. the proposed patch is a great idea and anything
> preventing it from being merged should be resolved so it can go back in.

Great Mike. I am already seeing you doing some changes to the headers in
CVS. Can you also push this patch once you are done with all the
changes. Please notify me once all are done. I plan to checkout a fresh
one for the upcoming release ;-)

Regards--
Subrata

> -mike