Re: [patch 1/1] selinux: minor cleanup in the hooks.c:file_map_prot_check() code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 23 Jun 2005 [email protected] wrote:

> Minor cleanup of the SELinux hooks code (hooks.c) around
> some definitions of return values.

>  static int file_map_prot_check(struct file *file, unsigned long prot, int shared)
>  {
> +	int rc;
> +
>  #ifndef CONFIG_PPC32
>  	if ((prot & PROT_EXEC) && (!file || (!shared && (prot & PROT_WRITE)))) {
>  		/*
> @@ -2426,7 +2428,7 @@ static int file_map_prot_check(struct fi
>  		 * private file mapping that will also be writable.
>  		 * This has an additional check.
>  		 */
> -		int rc = task_has_perm(current, current, PROCESS__EXECMEM);
> +		rc = task_has_perm(current, current, PROCESS__EXECMEM);
>  		if (rc)
>  			return rc;
>  	}

What is the point of this?  You're needlessly increasing the scope of rc 
and you'll also get a compiler warning on ppc32.

> @@ -2485,7 +2487,7 @@ static int selinux_file_mprotect(struct 
>  		 * check ability to execute the possibly modified content.
>  		 * This typically should only occur for text relocations.
>  		 */
> -		int rc = file_has_perm(current, vma->vm_file, FILE__EXECMOD);
> +		rc = file_has_perm(current, vma->vm_file, FILE__EXECMOD);
>  		if (rc)
>  			return rc;
>  	}
> _

No, causes ppc32 warning.

Please send SELinux kernel patches via the maintainers.


- James
-- 
James Morris
<[email protected]>


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux