public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix build warning in kernel/auditsc.c
@ 2008-08-29 20:33 Hannes Eder
  2008-08-30 12:04 ` walter harms
  0 siblings, 1 reply; 3+ messages in thread
From: Hannes Eder @ 2008-08-29 20:33 UTC (permalink / raw)
  To: linux-kernel, kernel-janitors

Fix this:

kernel/auditsc.c: In function 'audit_match_perm':
kernel/auditsc.c:249: warning: ISO C90 forbids mixed declarations and code

Signed-off-by: Hannes Eder <hannes@hanneseder.net>
---
 kernel/auditsc.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 972f8e6..e72b161 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -243,10 +243,12 @@ static inline int open_arg(int flags, int mask)
 
 static int audit_match_perm(struct audit_context *ctx, int mask)
 {
+	unsigned n;
+
 	if (unlikely(!ctx))
 		return 0;
 
-	unsigned n = ctx->major;
+	n = ctx->major;
 	switch (audit_classify_syscall(ctx->arch, n)) {
 	case 0:	/* native */
 		if ((mask & AUDIT_PERM_WRITE) &&

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix build warning in kernel/auditsc.c
  2008-08-29 20:33 [PATCH] Fix build warning in kernel/auditsc.c Hannes Eder
@ 2008-08-30 12:04 ` walter harms
  2008-08-31  9:21   ` Hannes Eder
  0 siblings, 1 reply; 3+ messages in thread
From: walter harms @ 2008-08-30 12:04 UTC (permalink / raw)
  To: Hannes Eder; +Cc: linux-kernel, kernel-janitors

nice catch

I have only an older version here, in that n is constant.
maybe you can do a s/n/ctx->major/g ?
removing the need for the whole variable ?!

re,
  wh


Hannes Eder schrieb:
> Fix this:
> 
> kernel/auditsc.c: In function 'audit_match_perm':
> kernel/auditsc.c:249: warning: ISO C90 forbids mixed declarations and code
> 
> Signed-off-by: Hannes Eder <hannes@hanneseder.net>
> ---
>  kernel/auditsc.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/kernel/auditsc.c b/kernel/auditsc.c
> index 972f8e6..e72b161 100644
> --- a/kernel/auditsc.c
> +++ b/kernel/auditsc.c
> @@ -243,10 +243,12 @@ static inline int open_arg(int flags, int mask)
>  
>  static int audit_match_perm(struct audit_context *ctx, int mask)
>  {
> +	unsigned n;
> +
>  	if (unlikely(!ctx))
>  		return 0;
>  
> -	unsigned n = ctx->major;
> +	n = ctx->major;
>  	switch (audit_classify_syscall(ctx->arch, n)) {
>  	case 0:	/* native */
>  		if ((mask & AUDIT_PERM_WRITE) &&
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix build warning in kernel/auditsc.c
  2008-08-30 12:04 ` walter harms
@ 2008-08-31  9:21   ` Hannes Eder
  0 siblings, 0 replies; 3+ messages in thread
From: Hannes Eder @ 2008-08-31  9:21 UTC (permalink / raw)
  To: wharms; +Cc: linux-kernel, kernel-janitors

Fix the following build warning, by eliminating the variable.

kernel/auditsc.c: In function 'audit_match_perm':
kernel/auditsc.c:249: warning: ISO C90 forbids mixed declarations and code

Signed-off-by: Hannes Eder <hannes@hanneseder.net>
---
walter harms <wharms@bfs.de> wrote:
> maybe you can do a s/n/ctx->major/g ?
> removing the need for the whole variable ?!

Here we go.  Why is this better than splitting the variable declaration and
initialization, as in the previous patch?

 kernel/auditsc.c |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 972f8e6..f7d7ad4 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -246,28 +246,27 @@ static int audit_match_perm(struct audit_context
*ctx, int mask)
 	if (unlikely(!ctx))
 		return 0;

-	unsigned n = ctx->major;
-	switch (audit_classify_syscall(ctx->arch, n)) {
+	switch (audit_classify_syscall(ctx->arch, ctx->major)) {
 	case 0:	/* native */
 		if ((mask & AUDIT_PERM_WRITE) &&
-		     audit_match_class(AUDIT_CLASS_WRITE, n))
+		     audit_match_class(AUDIT_CLASS_WRITE, ctx->major))
 			return 1;
 		if ((mask & AUDIT_PERM_READ) &&
-		     audit_match_class(AUDIT_CLASS_READ, n))
+		     audit_match_class(AUDIT_CLASS_READ, ctx->major))
 			return 1;
 		if ((mask & AUDIT_PERM_ATTR) &&
-		     audit_match_class(AUDIT_CLASS_CHATTR, n))
+		     audit_match_class(AUDIT_CLASS_CHATTR, ctx->major))
 			return 1;
 		return 0;
 	case 1: /* 32bit on biarch */
 		if ((mask & AUDIT_PERM_WRITE) &&
-		     audit_match_class(AUDIT_CLASS_WRITE_32, n))
+		     audit_match_class(AUDIT_CLASS_WRITE_32, ctx->major))
 			return 1;
 		if ((mask & AUDIT_PERM_READ) &&
-		     audit_match_class(AUDIT_CLASS_READ_32, n))
+		     audit_match_class(AUDIT_CLASS_READ_32, ctx->major))
 			return 1;
 		if ((mask & AUDIT_PERM_ATTR) &&
-		     audit_match_class(AUDIT_CLASS_CHATTR_32, n))
+		     audit_match_class(AUDIT_CLASS_CHATTR_32, ctx->major))
 			return 1;
 		return 0;
 	case 2: /* open */

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-08-31  9:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-29 20:33 [PATCH] Fix build warning in kernel/auditsc.c Hannes Eder
2008-08-30 12:04 ` walter harms
2008-08-31  9:21   ` Hannes Eder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox