* [LTP] [PATCH] lib: fix offset in tst_resm_hexd
@ 2017-01-13 9:45 Jan Stancek
2017-01-16 9:26 ` Cyril Hrubis
0 siblings, 1 reply; 3+ messages in thread
From: Jan Stancek @ 2017-01-13 9:45 UTC (permalink / raw)
To: ltp
Commit f72ca5b9c484 "lib: add tst_res_hexd for newlib"
broke tst_resm_hexd when I moved "offset = strlen(tmesg)"
before macro that expands varargs.
Fix it by moving offset initialisation after EXPAND_VAR_ARGS.
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
lib/tst_res.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/tst_res.c b/lib/tst_res.c
index 261dec0fbba8..61daaeb4944e 100644
--- a/lib/tst_res.c
+++ b/lib/tst_res.c
@@ -509,7 +509,7 @@ void tst_resm_hexd_(const char *file, const int lineno, int ttype,
char tmesg[USERMESG];
static const size_t symb_num = 2; /* xx */
static const size_t size_max = 16;
- size_t offset = strlen(tmesg);
+ size_t offset;
size_t i;
char *pmesg = tmesg;
tst_res_func_t res_func;
@@ -520,6 +520,7 @@ void tst_resm_hexd_(const char *file, const int lineno, int ttype,
res_func = tst_res__;
EXPAND_VAR_ARGS(tmesg, arg_fmt, USERMESG);
+ offset = strlen(tmesg);
if (size > size_max || size == 0 ||
(offset + size * (symb_num + 1)) >= USERMESG)
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [LTP] [PATCH] lib: fix offset in tst_resm_hexd
2017-01-13 9:45 [LTP] [PATCH] lib: fix offset in tst_resm_hexd Jan Stancek
@ 2017-01-16 9:26 ` Cyril Hrubis
2017-01-16 13:33 ` Jan Stancek
0 siblings, 1 reply; 3+ messages in thread
From: Cyril Hrubis @ 2017-01-16 9:26 UTC (permalink / raw)
To: ltp
Hi!
> Commit f72ca5b9c484 "lib: add tst_res_hexd for newlib"
> broke tst_resm_hexd when I moved "offset = strlen(tmesg)"
> before macro that expands varargs.
>
> Fix it by moving offset initialisation after EXPAND_VAR_ARGS.
>
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
> ---
> lib/tst_res.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/lib/tst_res.c b/lib/tst_res.c
> index 261dec0fbba8..61daaeb4944e 100644
> --- a/lib/tst_res.c
> +++ b/lib/tst_res.c
> @@ -509,7 +509,7 @@ void tst_resm_hexd_(const char *file, const int lineno, int ttype,
> char tmesg[USERMESG];
> static const size_t symb_num = 2; /* xx */
> static const size_t size_max = 16;
> - size_t offset = strlen(tmesg);
> + size_t offset;
> size_t i;
> char *pmesg = tmesg;
> tst_res_func_t res_func;
> @@ -520,6 +520,7 @@ void tst_resm_hexd_(const char *file, const int lineno, int ttype,
> res_func = tst_res__;
>
> EXPAND_VAR_ARGS(tmesg, arg_fmt, USERMESG);
> + offset = strlen(tmesg);
>
> if (size > size_max || size == 0 ||
> (offset + size * (symb_num + 1)) >= USERMESG)
Good catch. Thanks for fixing this, acked.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 3+ messages in thread
* [LTP] [PATCH] lib: fix offset in tst_resm_hexd
2017-01-16 9:26 ` Cyril Hrubis
@ 2017-01-16 13:33 ` Jan Stancek
0 siblings, 0 replies; 3+ messages in thread
From: Jan Stancek @ 2017-01-16 13:33 UTC (permalink / raw)
To: ltp
----- Original Message -----
> From: "Cyril Hrubis" <chrubis@suse.cz>
> To: "Jan Stancek" <jstancek@redhat.com>
> Cc: ltp@lists.linux.it
> Sent: Monday, 16 January, 2017 10:26:59 AM
> Subject: Re: [PATCH] lib: fix offset in tst_resm_hexd
>
> Hi!
> > Commit f72ca5b9c484 "lib: add tst_res_hexd for newlib"
> > broke tst_resm_hexd when I moved "offset = strlen(tmesg)"
> > before macro that expands varargs.
> >
> > Fix it by moving offset initialisation after EXPAND_VAR_ARGS.
> >
> > Signed-off-by: Jan Stancek <jstancek@redhat.com>
> > ---
> > lib/tst_res.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/lib/tst_res.c b/lib/tst_res.c
> > index 261dec0fbba8..61daaeb4944e 100644
> > --- a/lib/tst_res.c
> > +++ b/lib/tst_res.c
> > @@ -509,7 +509,7 @@ void tst_resm_hexd_(const char *file, const int lineno,
> > int ttype,
> > char tmesg[USERMESG];
> > static const size_t symb_num = 2; /* xx */
> > static const size_t size_max = 16;
> > - size_t offset = strlen(tmesg);
> > + size_t offset;
> > size_t i;
> > char *pmesg = tmesg;
> > tst_res_func_t res_func;
> > @@ -520,6 +520,7 @@ void tst_resm_hexd_(const char *file, const int lineno,
> > int ttype,
> > res_func = tst_res__;
> >
> > EXPAND_VAR_ARGS(tmesg, arg_fmt, USERMESG);
> > + offset = strlen(tmesg);
> >
> > if (size > size_max || size == 0 ||
> > (offset + size * (symb_num + 1)) >= USERMESG)
>
> Good catch. Thanks for fixing this, acked.
Pushed.
>
> --
> Cyril Hrubis
> chrubis@suse.cz
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-01-16 13:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-13 9:45 [LTP] [PATCH] lib: fix offset in tst_resm_hexd Jan Stancek
2017-01-16 9:26 ` Cyril Hrubis
2017-01-16 13:33 ` Jan Stancek
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.