diff mbox series

[01/12] checkpolicy: use correct unsigned format specifiers

Message ID 20211112154201.78217-1-cgzones@googlemail.com (mailing list archive)
State Accepted
Headers show
Series [01/12] checkpolicy: use correct unsigned format specifiers | expand

Commit Message

Christian Göttsche Nov. 12, 2021, 3:41 p.m. UTC
The two variables policydb_lineno and source_lineno are both of the type
unsigned long; use the appropriate format specifier.

Found by Cppcheck

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
 checkpolicy/policy_scan.l | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

James Carter Nov. 15, 2021, 9:48 p.m. UTC | #1
On Fri, Nov 12, 2021 at 10:42 AM Christian Göttsche
<cgzones@googlemail.com> wrote:
>
> The two variables policydb_lineno and source_lineno are both of the type
> unsigned long; use the appropriate format specifier.
>
> Found by Cppcheck
>
> Signed-off-by: Christian Göttsche <cgzones@googlemail.com>

For all 12 patches.
Acked-by: James Carter <jwcart2@gmail.com>

> ---
>  checkpolicy/policy_scan.l | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/checkpolicy/policy_scan.l b/checkpolicy/policy_scan.l
> index 129a8a2a..ef9f1899 100644
> --- a/checkpolicy/policy_scan.l
> +++ b/checkpolicy/policy_scan.l
> @@ -308,11 +308,11 @@ GLBLUB                            { return(GLBLUB); }
>  int yyerror(const char *msg)
>  {
>         if (source_file[0])
> -               fprintf(stderr, "%s:%ld:",
> +               fprintf(stderr, "%s:%lu:",
>                         source_file, source_lineno);
>         else
>                 fprintf(stderr, "(unknown source)::");
> -       fprintf(stderr, "ERROR '%s' at token '%s' on line %ld:\n%s\n%s\n",
> +       fprintf(stderr, "ERROR '%s' at token '%s' on line %lu:\n%s\n%s\n",
>                         msg,
>                         yytext,
>                         policydb_lineno,
> @@ -327,11 +327,11 @@ int yywarn(const char *msg)
>                 return yyerror(msg);
>
>         if (source_file[0])
> -               fprintf(stderr, "%s:%ld:",
> +               fprintf(stderr, "%s:%lu:",
>                         source_file, source_lineno);
>         else
>                 fprintf(stderr, "(unknown source)::");
> -       fprintf(stderr, "WARNING '%s' at token '%s' on line %ld:\n%s\n%s\n",
> +       fprintf(stderr, "WARNING '%s' at token '%s' on line %lu:\n%s\n%s\n",
>                         msg,
>                         yytext,
>                         policydb_lineno,
> --
> 2.33.1
>
James Carter Nov. 18, 2021, 4:17 p.m. UTC | #2
On Mon, Nov 15, 2021 at 4:48 PM James Carter <jwcart2@gmail.com> wrote:
>
> On Fri, Nov 12, 2021 at 10:42 AM Christian Göttsche
> <cgzones@googlemail.com> wrote:
> >
> > The two variables policydb_lineno and source_lineno are both of the type
> > unsigned long; use the appropriate format specifier.
> >
> > Found by Cppcheck
> >
> > Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
>
> For all 12 patches.
> Acked-by: James Carter <jwcart2@gmail.com>
>

This has been merged.
Thanks,
Jim

> > ---
> >  checkpolicy/policy_scan.l | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/checkpolicy/policy_scan.l b/checkpolicy/policy_scan.l
> > index 129a8a2a..ef9f1899 100644
> > --- a/checkpolicy/policy_scan.l
> > +++ b/checkpolicy/policy_scan.l
> > @@ -308,11 +308,11 @@ GLBLUB                            { return(GLBLUB); }
> >  int yyerror(const char *msg)
> >  {
> >         if (source_file[0])
> > -               fprintf(stderr, "%s:%ld:",
> > +               fprintf(stderr, "%s:%lu:",
> >                         source_file, source_lineno);
> >         else
> >                 fprintf(stderr, "(unknown source)::");
> > -       fprintf(stderr, "ERROR '%s' at token '%s' on line %ld:\n%s\n%s\n",
> > +       fprintf(stderr, "ERROR '%s' at token '%s' on line %lu:\n%s\n%s\n",
> >                         msg,
> >                         yytext,
> >                         policydb_lineno,
> > @@ -327,11 +327,11 @@ int yywarn(const char *msg)
> >                 return yyerror(msg);
> >
> >         if (source_file[0])
> > -               fprintf(stderr, "%s:%ld:",
> > +               fprintf(stderr, "%s:%lu:",
> >                         source_file, source_lineno);
> >         else
> >                 fprintf(stderr, "(unknown source)::");
> > -       fprintf(stderr, "WARNING '%s' at token '%s' on line %ld:\n%s\n%s\n",
> > +       fprintf(stderr, "WARNING '%s' at token '%s' on line %lu:\n%s\n%s\n",
> >                         msg,
> >                         yytext,
> >                         policydb_lineno,
> > --
> > 2.33.1
> >
diff mbox series

Patch

diff --git a/checkpolicy/policy_scan.l b/checkpolicy/policy_scan.l
index 129a8a2a..ef9f1899 100644
--- a/checkpolicy/policy_scan.l
+++ b/checkpolicy/policy_scan.l
@@ -308,11 +308,11 @@  GLBLUB				{ return(GLBLUB); }
 int yyerror(const char *msg)
 {
 	if (source_file[0])
-		fprintf(stderr, "%s:%ld:",
+		fprintf(stderr, "%s:%lu:",
 			source_file, source_lineno);
 	else
 		fprintf(stderr, "(unknown source)::");
-	fprintf(stderr, "ERROR '%s' at token '%s' on line %ld:\n%s\n%s\n",
+	fprintf(stderr, "ERROR '%s' at token '%s' on line %lu:\n%s\n%s\n",
 			msg,
 			yytext,
 			policydb_lineno,
@@ -327,11 +327,11 @@  int yywarn(const char *msg)
 		return yyerror(msg);
 
 	if (source_file[0])
-		fprintf(stderr, "%s:%ld:",
+		fprintf(stderr, "%s:%lu:",
 			source_file, source_lineno);
 	else
 		fprintf(stderr, "(unknown source)::");
-	fprintf(stderr, "WARNING '%s' at token '%s' on line %ld:\n%s\n%s\n",
+	fprintf(stderr, "WARNING '%s' at token '%s' on line %lu:\n%s\n%s\n",
 			msg,
 			yytext,
 			policydb_lineno,