public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Subrata Modak <subrata@linux.vnet.ibm.com>
To: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Cc: Linux Test Project <Ltp-list@lists.sourceforge.net>
Subject: Re: [LTP] [PATCH] Annotate tst_*() helpers with	__attribute__	((format (printf, M, N))) (was: Re: [PATCH] quotactl01: Fix	tst_resm()	format causing	crash)
Date: Fri, 28 Aug 2009 14:08:17 +0530	[thread overview]
Message-ID: <1251448700.9081.13.camel@subratamodak.linux.ibm.com> (raw)
In-Reply-To: <1251439738.9081.9.camel@subratamodak.linux.ibm.com>

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.

Regards--
Subrata

> 
> Regards--
> Subrata
> 
> > ---
> >  include/test.h |   18 ++++++++++++------
> >  1 files changed, 12 insertions(+), 6 deletions(-)
> > 
> > diff --git a/include/test.h b/include/test.h
> > index 34ed5d2..03b0d46 100644
> > --- a/include/test.h
> > +++ b/include/test.h
> > @@ -186,12 +186,18 @@
> >   * Functions from lib/tst_res.c
> >   */
> >  const char *strttype(int ttype);
> > -void tst_res(int ttype, char *fname, char *arg_fmt, ...);
> > -void tst_resm(int ttype, char *arg_fmt, ...);
> > -void tst_brk(int ttype, char *fname, void (*func)(void), char *arg_fmt, ...);
> > -void tst_brkloop(int ttype, char *fname, void (*func)(void), char *arg_fmt, ...);
> > -void tst_brkm(int ttype, void (*func)(void), char *arg_fmt, ...);
> > -void tst_brkloopm(int ttype, void (*func)(void), char *arg_fmt, ...);
> > +void tst_res(int ttype, char *fname, char *arg_fmt, ...)
> > +	__attribute__ ((format (printf, 3, 4)));
> > +void tst_resm(int ttype, char *arg_fmt, ...)
> > +	__attribute__ ((format (printf, 2, 3)));
> > +void tst_brk(int ttype, char *fname, void (*func)(void), char *arg_fmt, ...)
> > +	__attribute__ ((format (printf, 4, 5)));
> > +void tst_brkloop(int ttype, char *fname, void (*func)(void), char *arg_fmt, ...)
> > +	__attribute__ ((format (printf, 4, 5)));
> > +void tst_brkm(int ttype, void (*func)(void), char *arg_fmt, ...)
> > +	__attribute__ ((format (printf, 3, 4)));
> > +void tst_brkloopm(int ttype, void (*func)(void), char *arg_fmt, ...)
> > +	__attribute__ ((format (printf, 3, 4)));
> >  void tst_require_root(void (*func)(void));
> >  int  tst_environ(void);
> >  void tst_exit(void) LTP_ATTRIBUTE_NORETURN;
> 
> 
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
> trial. Simplify your report design, integration and deployment - and focus on 
> what you do best, core application coding. Discover what's new with 
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

  reply	other threads:[~2009-08-28  8:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-27 15:04 [LTP] [PATCH] quotactl01: Fix tst_resm() format causing crash Geert Uytterhoeven
2009-08-27 15:29 ` [LTP] [PATCH] Annotate tst_*() helpers with __attribute__ ((format (printf, M, N))) (was: Re: [PATCH] quotactl01: Fix tst_resm() format causing crash) Geert Uytterhoeven
2009-08-28  6:08   ` Subrata Modak
2009-08-28  8:38     ` Subrata Modak [this message]
2009-08-28  8:48       ` Geert Uytterhoeven
2009-08-28 10:16         ` [LTP] [PATCH] Annotate tst_*() helpers with __attribute__ ((format (printf, M, N))) Mike Frysinger
2009-08-28  9:14       ` [LTP] [PATCH] Annotate tst_*() helpers with __attribute__ ((format (printf, M, N))) (was: Re: [PATCH] quotactl01: Fix tst_resm () format causing crash ) Mike Frysinger
2009-08-28 10:11         ` Subrata Modak
2009-08-28 14:44           ` [LTP] [PATCH] Annotate tst_*() helpers with __attribute__ ((format (printf, M, N))) Mike Frysinger
2009-08-28 14:54             ` [LTP] [PATCH] Annotate tst_*() helpers with?__attribute__ " Cyril Hrubis
     [not found]               ` <200908281106.13828.vapier@gentoo.org>
2009-08-28 16:29                 ` Cyril Hrubis
     [not found]                   ` <200908281517.46228.vapier@gentoo.org>
2009-08-31 10:06                     ` Cyril Hrubis
     [not found]                       ` <200908311633.32124.vapier@gentoo.org>
2009-09-03 18:05                         ` Cyril Hrubis
2009-08-30 17:37             ` [LTP] [PATCH] Annotate tst_*() helpers with __attribute__ " Subrata Modak
2009-08-27 19:22 ` [LTP] [PATCH] quotactl01: Fix tst_resm() format causing crash Mike Frysinger

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=1251448700.9081.13.camel@subratamodak.linux.ibm.com \
    --to=subrata@linux.vnet.ibm.com \
    --cc=Geert.Uytterhoeven@sonycom.com \
    --cc=Ltp-list@lists.sourceforge.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox