linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] ext4: use XATTR_*_PREFIX_LEN instead sizeof(...)
@ 2016-01-03 19:56 Toralf Förster
  2016-01-03 19:56 ` [PATCH 2/2] security: " Toralf Förster
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Toralf Förster @ 2016-01-03 19:56 UTC (permalink / raw)
  To: linux-security-module, linux-ext4; +Cc: linux-kernel, Toralf Förster

use the definition in include/uapi/linux/xattr.h

Signed-off-by: Toralf Förster <toralf.foerster@gmx.de>
---
 fs/ext4/xattr_security.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ext4/xattr_security.c b/fs/ext4/xattr_security.c
index 36f4c1a..1a3d629 100644
--- a/fs/ext4/xattr_security.c
+++ b/fs/ext4/xattr_security.c
@@ -16,7 +16,7 @@ ext4_xattr_security_list(const struct xattr_handler *handler,
 			 struct dentry *dentry, char *list, size_t list_size,
 			 const char *name, size_t name_len)
 {
-	const size_t prefix_len = sizeof(XATTR_SECURITY_PREFIX)-1;
+	const size_t prefix_len = XATTR_SECURITY_PREFIX_LEN;
 	const size_t total_len = prefix_len + name_len + 1;
 
 
-- 
2.4.10

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" 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 related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] security: use XATTR_*_PREFIX_LEN instead sizeof(...)
  2016-01-03 19:56 [PATCH 1/2] ext4: use XATTR_*_PREFIX_LEN instead sizeof(...) Toralf Förster
@ 2016-01-03 19:56 ` Toralf Förster
  2016-01-05 17:14 ` [PATCH 1/2] ext4: " Jan Kara
  2016-01-06  9:14 ` José Bollo
  2 siblings, 0 replies; 5+ messages in thread
From: Toralf Förster @ 2016-01-03 19:56 UTC (permalink / raw)
  To: linux-security-module, linux-ext4; +Cc: linux-kernel, Toralf Förster

use the definition in include/uapi/linux/xattr.h

igned-off-by: Toralf Förster <toralf.foerster@gmx.de>
---
 security/commoncap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/security/commoncap.c b/security/commoncap.c
index 1832cf7..907a3ef 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -658,7 +658,7 @@ int cap_inode_setxattr(struct dentry *dentry, const char *name,
 	}
 
 	if (!strncmp(name, XATTR_SECURITY_PREFIX,
-		     sizeof(XATTR_SECURITY_PREFIX) - 1) &&
+		     XATTR_SECURITY_PREFIX_LEN) &&
 	    !capable(CAP_SYS_ADMIN))
 		return -EPERM;
 	return 0;
@@ -684,7 +684,7 @@ int cap_inode_removexattr(struct dentry *dentry, const char *name)
 	}
 
 	if (!strncmp(name, XATTR_SECURITY_PREFIX,
-		     sizeof(XATTR_SECURITY_PREFIX) - 1) &&
+		     XATTR_SECURITY_PREFIX_LEN) &&
 	    !capable(CAP_SYS_ADMIN))
 		return -EPERM;
 	return 0;
-- 
2.4.10

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

* Re: [PATCH 1/2] ext4: use XATTR_*_PREFIX_LEN instead sizeof(...)
  2016-01-03 19:56 [PATCH 1/2] ext4: use XATTR_*_PREFIX_LEN instead sizeof(...) Toralf Förster
  2016-01-03 19:56 ` [PATCH 2/2] security: " Toralf Förster
@ 2016-01-05 17:14 ` Jan Kara
  2016-01-06  9:14 ` José Bollo
  2 siblings, 0 replies; 5+ messages in thread
From: Jan Kara @ 2016-01-05 17:14 UTC (permalink / raw)
  To: Toralf Förster; +Cc: linux-security-module, linux-ext4, linux-kernel

On Sun 03-01-16 20:56:37, Toralf Förster wrote:
> use the definition in include/uapi/linux/xattr.h
> 
> Signed-off-by: Toralf Förster <toralf.foerster@gmx.de>

Looks good. You can add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/ext4/xattr_security.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ext4/xattr_security.c b/fs/ext4/xattr_security.c
> index 36f4c1a..1a3d629 100644
> --- a/fs/ext4/xattr_security.c
> +++ b/fs/ext4/xattr_security.c
> @@ -16,7 +16,7 @@ ext4_xattr_security_list(const struct xattr_handler *handler,
>  			 struct dentry *dentry, char *list, size_t list_size,
>  			 const char *name, size_t name_len)
>  {
> -	const size_t prefix_len = sizeof(XATTR_SECURITY_PREFIX)-1;
> +	const size_t prefix_len = XATTR_SECURITY_PREFIX_LEN;
>  	const size_t total_len = prefix_len + name_len + 1;
>  
>  
> -- 
> 2.4.10
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" 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] 5+ messages in thread

* [PATCH 1/2] ext4: use XATTR_*_PREFIX_LEN instead sizeof(...)
@ 2016-01-05 17:49 Toralf Förster
  0 siblings, 0 replies; 5+ messages in thread
From: Toralf Förster @ 2016-01-05 17:49 UTC (permalink / raw)
  To: linux-ext4; +Cc: linux-kernel, jack, Toralf Förster

use the definition in include/uapi/linux/xattr.h

Signed-off-by: Toralf Förster <toralf.foerster@gmx.de>
Reviewed-by: Jan Kara <jack@suse.cz>

---
 fs/ext4/xattr_security.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ext4/xattr_security.c b/fs/ext4/xattr_security.c
index 36f4c1a..1a3d629 100644
--- a/fs/ext4/xattr_security.c
+++ b/fs/ext4/xattr_security.c
@@ -16,7 +16,7 @@ ext4_xattr_security_list(const struct xattr_handler *handler,
 			 struct dentry *dentry, char *list, size_t list_size,
 			 const char *name, size_t name_len)
 {
-	const size_t prefix_len = sizeof(XATTR_SECURITY_PREFIX)-1;
+	const size_t prefix_len = XATTR_SECURITY_PREFIX_LEN;
 	const size_t total_len = prefix_len + name_len + 1;
 
 
-- 
2.4.10

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

* Re: [PATCH 1/2] ext4: use XATTR_*_PREFIX_LEN instead sizeof(...)
  2016-01-03 19:56 [PATCH 1/2] ext4: use XATTR_*_PREFIX_LEN instead sizeof(...) Toralf Förster
  2016-01-03 19:56 ` [PATCH 2/2] security: " Toralf Förster
  2016-01-05 17:14 ` [PATCH 1/2] ext4: " Jan Kara
@ 2016-01-06  9:14 ` José Bollo
  2 siblings, 0 replies; 5+ messages in thread
From: José Bollo @ 2016-01-06  9:14 UTC (permalink / raw)
  To: Toralf Förster; +Cc: linux-security-module, linux-ext4, linux-kernel

I prefer the use of sizeof that can't be faked even by error but why not

Le dimanche 03 janvier 2016 à 20:56 +0100, Toralf Förster a écrit :
> use the definition in include/uapi/linux/xattr.h
> 
> Signed-off-by: Toralf Förster <toralf.foerster@gmx.de>
> ---
>  fs/ext4/xattr_security.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ext4/xattr_security.c b/fs/ext4/xattr_security.c
> index 36f4c1a..1a3d629 100644
> --- a/fs/ext4/xattr_security.c
> +++ b/fs/ext4/xattr_security.c
> @@ -16,7 +16,7 @@ ext4_xattr_security_list(const struct xattr_handler *handler,
>  			 struct dentry *dentry, char *list, size_t list_size,
>  			 const char *name, size_t name_len)
>  {
> -	const size_t prefix_len = sizeof(XATTR_SECURITY_PREFIX)-1;
> +	const size_t prefix_len = XATTR_SECURITY_PREFIX_LEN;
>  	const size_t total_len = prefix_len + name_len + 1;
>  
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" 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] 5+ messages in thread

end of thread, other threads:[~2016-01-06  9:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-03 19:56 [PATCH 1/2] ext4: use XATTR_*_PREFIX_LEN instead sizeof(...) Toralf Förster
2016-01-03 19:56 ` [PATCH 2/2] security: " Toralf Förster
2016-01-05 17:14 ` [PATCH 1/2] ext4: " Jan Kara
2016-01-06  9:14 ` José Bollo
  -- strict thread matches above, loose matches on Subject: below --
2016-01-05 17:49 Toralf Förster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).