Linux-Integrity Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v2] security: mark expected switch fall-throughs and add a missing break
@ 2019-02-08 20:54 Gustavo A. R. Silva
  2019-02-08 21:13 ` Mimi Zohar
  2019-02-22 17:57 ` James Morris
  0 siblings, 2 replies; 7+ messages in thread
From: Gustavo A. R. Silva @ 2019-02-08 20:54 UTC (permalink / raw)
  To: John Johansen, James Morris, Serge E. Hallyn, Mimi Zohar,
	Dmitry Kasatkin, Casey Schaufler
  Cc: linux-security-module, linux-kernel, linux-integrity,
	Gustavo A. R. Silva

In preparation to enabling -Wimplicit-fallthrough, mark switch
cases where we are expecting to fall through.

This patch fixes the following warnings:

security/integrity/ima/ima_template_lib.c:85:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
security/integrity/ima/ima_policy.c:940:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
security/integrity/ima/ima_policy.c:943:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
security/integrity/ima/ima_policy.c:972:21: warning: this statement may fall through [-Wimplicit-fallthrough=]
security/integrity/ima/ima_policy.c:974:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
security/smack/smack_lsm.c:3391:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
security/apparmor/domain.c:569:6: warning: this statement may fall through [-Wimplicit-fallthrough=]

Warning level 3 was used: -Wimplicit-fallthrough=3

Also, add a missing break statement to fix the following warning:

security/integrity/ima/ima_appraise.c:116:26: warning: this statement may fall through [-Wimplicit-fallthrough=]

Acked-by: John Johansen <john.johansen@canonical.com>
Acked-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
Changes in v2:
 - Update Subject.
 - Integrate a missing break in switch fix by Mimi Zohar.

 security/apparmor/domain.c                | 2 +-
 security/integrity/ima/ima_appraise.c     | 1 +
 security/integrity/ima/ima_policy.c       | 4 ++++
 security/integrity/ima/ima_template_lib.c | 1 +
 security/smack/smack_lsm.c                | 3 +--
 5 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/security/apparmor/domain.c b/security/apparmor/domain.c
index 3b266a438776..ca2dccf5b445 100644
--- a/security/apparmor/domain.c
+++ b/security/apparmor/domain.c
@@ -572,7 +572,7 @@ static struct aa_label *x_to_label(struct aa_profile *profile,
 			stack = NULL;
 			break;
 		}
-		/* fall through to X_NAME */
+		/* fall through - to X_NAME */
 	case AA_X_NAME:
 		if (xindex & AA_X_CHILD)
 			/* released by caller */
diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c
index a2baa85ea2f5..5fb7127bbe68 100644
--- a/security/integrity/ima/ima_appraise.c
+++ b/security/integrity/ima/ima_appraise.c
@@ -114,6 +114,7 @@ static void ima_set_cache_status(struct integrity_iint_cache *iint,
 		break;
 	case CREDS_CHECK:
 		iint->ima_creds_status = status;
+		break;
 	case FILE_CHECK:
 	case POST_SETATTR:
 		iint->ima_file_status = status;
diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
index 26fa9d9723f6..e0cc323f948f 100644
--- a/security/integrity/ima/ima_policy.c
+++ b/security/integrity/ima/ima_policy.c
@@ -936,10 +936,12 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
 		case Opt_uid_gt:
 		case Opt_euid_gt:
 			entry->uid_op = &uid_gt;
+			/* fall through */
 		case Opt_uid_lt:
 		case Opt_euid_lt:
 			if ((token == Opt_uid_lt) || (token == Opt_euid_lt))
 				entry->uid_op = &uid_lt;
+			/* fall through */
 		case Opt_uid_eq:
 		case Opt_euid_eq:
 			uid_token = (token == Opt_uid_eq) ||
@@ -968,9 +970,11 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
 			break;
 		case Opt_fowner_gt:
 			entry->fowner_op = &uid_gt;
+			/* fall through */
 		case Opt_fowner_lt:
 			if (token == Opt_fowner_lt)
 				entry->fowner_op = &uid_lt;
+			/* fall through */
 		case Opt_fowner_eq:
 			ima_log_string_op(ab, "fowner", args[0].from,
 					  entry->fowner_op);
diff --git a/security/integrity/ima/ima_template_lib.c b/security/integrity/ima/ima_template_lib.c
index 43752002c222..513b457ae900 100644
--- a/security/integrity/ima/ima_template_lib.c
+++ b/security/integrity/ima/ima_template_lib.c
@@ -83,6 +83,7 @@ static void ima_show_template_data_ascii(struct seq_file *m,
 		/* skip ':' and '\0' */
 		buf_ptr += 2;
 		buflen -= buf_ptr - field_data->data;
+		/* fall through */
 	case DATA_FMT_DIGEST:
 	case DATA_FMT_HEX:
 		if (!buflen)
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index 587dc06eba33..5c1613519d5a 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -3380,13 +3380,12 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode)
 		 */
 		final = &smack_known_star;
 		/*
-		 * Fall through.
-		 *
 		 * If a smack value has been set we want to use it,
 		 * but since tmpfs isn't giving us the opportunity
 		 * to set mount options simulate setting the
 		 * superblock default.
 		 */
+		/* Fall through */
 	default:
 		/*
 		 * This isn't an understood special case.
-- 
2.20.1


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

* Re: [PATCH v2] security: mark expected switch fall-throughs and add a missing break
  2019-02-08 20:54 [PATCH v2] security: mark expected switch fall-throughs and add a missing break Gustavo A. R. Silva
@ 2019-02-08 21:13 ` Mimi Zohar
  2019-02-19  2:53   ` Gustavo A. R. Silva
  2019-02-22 17:57 ` James Morris
  1 sibling, 1 reply; 7+ messages in thread
From: Mimi Zohar @ 2019-02-08 21:13 UTC (permalink / raw)
  To: Gustavo A. R. Silva, John Johansen, James Morris,
	Serge E. Hallyn, Dmitry Kasatkin, Casey Schaufler
  Cc: linux-security-module, linux-kernel, linux-integrity

On Fri, 2019-02-08 at 14:54 -0600, Gustavo A. R. Silva wrote:
> In preparation to enabling -Wimplicit-fallthrough, mark switch
> cases where we are expecting to fall through.
> 
> This patch fixes the following warnings:
> 
> security/integrity/ima/ima_template_lib.c:85:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
> security/integrity/ima/ima_policy.c:940:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
> security/integrity/ima/ima_policy.c:943:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
> security/integrity/ima/ima_policy.c:972:21: warning: this statement may fall through [-Wimplicit-fallthrough=]
> security/integrity/ima/ima_policy.c:974:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
> security/smack/smack_lsm.c:3391:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
> security/apparmor/domain.c:569:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
> 
> Warning level 3 was used: -Wimplicit-fallthrough=3
> 
> Also, add a missing break statement to fix the following warning:
> 
> security/integrity/ima/ima_appraise.c:116:26: warning: this statement may fall through [-Wimplicit-fallthrough=]
> 
> Acked-by: John Johansen <john.johansen@canonical.com>
> Acked-by: Casey Schaufler <casey@schaufler-ca.com>
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>

Acked-by: Mimi Zohar <zohar@linux.ibm.com>

> ---
> Changes in v2:
>  - Update Subject.
>  - Integrate a missing break in switch fix by Mimi Zohar.
> 
>  security/apparmor/domain.c                | 2 +-
>  security/integrity/ima/ima_appraise.c     | 1 +
>  security/integrity/ima/ima_policy.c       | 4 ++++
>  security/integrity/ima/ima_template_lib.c | 1 +
>  security/smack/smack_lsm.c                | 3 +--
>  5 files changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/security/apparmor/domain.c b/security/apparmor/domain.c
> index 3b266a438776..ca2dccf5b445 100644
> --- a/security/apparmor/domain.c
> +++ b/security/apparmor/domain.c
> @@ -572,7 +572,7 @@ static struct aa_label *x_to_label(struct aa_profile *profile,
>  			stack = NULL;
>  			break;
>  		}
> -		/* fall through to X_NAME */
> +		/* fall through - to X_NAME */
>  	case AA_X_NAME:
>  		if (xindex & AA_X_CHILD)
>  			/* released by caller */
> diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c
> index a2baa85ea2f5..5fb7127bbe68 100644
> --- a/security/integrity/ima/ima_appraise.c
> +++ b/security/integrity/ima/ima_appraise.c
> @@ -114,6 +114,7 @@ static void ima_set_cache_status(struct integrity_iint_cache *iint,
>  		break;
>  	case CREDS_CHECK:
>  		iint->ima_creds_status = status;
> +		break;
>  	case FILE_CHECK:
>  	case POST_SETATTR:
>  		iint->ima_file_status = status;
> diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
> index 26fa9d9723f6..e0cc323f948f 100644
> --- a/security/integrity/ima/ima_policy.c
> +++ b/security/integrity/ima/ima_policy.c
> @@ -936,10 +936,12 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
>  		case Opt_uid_gt:
>  		case Opt_euid_gt:
>  			entry->uid_op = &uid_gt;
> +			/* fall through */
>  		case Opt_uid_lt:
>  		case Opt_euid_lt:
>  			if ((token == Opt_uid_lt) || (token == Opt_euid_lt))
>  				entry->uid_op = &uid_lt;
> +			/* fall through */
>  		case Opt_uid_eq:
>  		case Opt_euid_eq:
>  			uid_token = (token == Opt_uid_eq) ||
> @@ -968,9 +970,11 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
>  			break;
>  		case Opt_fowner_gt:
>  			entry->fowner_op = &uid_gt;
> +			/* fall through */
>  		case Opt_fowner_lt:
>  			if (token == Opt_fowner_lt)
>  				entry->fowner_op = &uid_lt;
> +			/* fall through */
>  		case Opt_fowner_eq:
>  			ima_log_string_op(ab, "fowner", args[0].from,
>  					  entry->fowner_op);
> diff --git a/security/integrity/ima/ima_template_lib.c b/security/integrity/ima/ima_template_lib.c
> index 43752002c222..513b457ae900 100644
> --- a/security/integrity/ima/ima_template_lib.c
> +++ b/security/integrity/ima/ima_template_lib.c
> @@ -83,6 +83,7 @@ static void ima_show_template_data_ascii(struct seq_file *m,
>  		/* skip ':' and '\0' */
>  		buf_ptr += 2;
>  		buflen -= buf_ptr - field_data->data;
> +		/* fall through */
>  	case DATA_FMT_DIGEST:
>  	case DATA_FMT_HEX:
>  		if (!buflen)
> diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
> index 587dc06eba33..5c1613519d5a 100644
> --- a/security/smack/smack_lsm.c
> +++ b/security/smack/smack_lsm.c
> @@ -3380,13 +3380,12 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode)
>  		 */
>  		final = &smack_known_star;
>  		/*
> -		 * Fall through.
> -		 *
>  		 * If a smack value has been set we want to use it,
>  		 * but since tmpfs isn't giving us the opportunity
>  		 * to set mount options simulate setting the
>  		 * superblock default.
>  		 */
> +		/* Fall through */
>  	default:
>  		/*
>  		 * This isn't an understood special case.


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

* Re: [PATCH v2] security: mark expected switch fall-throughs and add a missing break
  2019-02-08 21:13 ` Mimi Zohar
@ 2019-02-19  2:53   ` Gustavo A. R. Silva
  2019-02-22 17:16     ` Gustavo A. R. Silva
  0 siblings, 1 reply; 7+ messages in thread
From: Gustavo A. R. Silva @ 2019-02-19  2:53 UTC (permalink / raw)
  To: Mimi Zohar, John Johansen, James Morris, Serge E. Hallyn,
	Dmitry Kasatkin, Casey Schaufler
  Cc: linux-security-module, linux-kernel, linux-integrity, Kees Cook



On 2/8/19 3:13 PM, Mimi Zohar wrote:
> On Fri, 2019-02-08 at 14:54 -0600, Gustavo A. R. Silva wrote:
>> In preparation to enabling -Wimplicit-fallthrough, mark switch
>> cases where we are expecting to fall through.
>>
>> This patch fixes the following warnings:
>>
>> security/integrity/ima/ima_template_lib.c:85:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
>> security/integrity/ima/ima_policy.c:940:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
>> security/integrity/ima/ima_policy.c:943:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
>> security/integrity/ima/ima_policy.c:972:21: warning: this statement may fall through [-Wimplicit-fallthrough=]
>> security/integrity/ima/ima_policy.c:974:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
>> security/smack/smack_lsm.c:3391:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
>> security/apparmor/domain.c:569:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
>>
>> Warning level 3 was used: -Wimplicit-fallthrough=3
>>
>> Also, add a missing break statement to fix the following warning:
>>
>> security/integrity/ima/ima_appraise.c:116:26: warning: this statement may fall through [-Wimplicit-fallthrough=]
>>
>> Acked-by: John Johansen <john.johansen@canonical.com>
>> Acked-by: Casey Schaufler <casey@schaufler-ca.com>
>> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> 
> Acked-by: Mimi Zohar <zohar@linux.ibm.com>
> 

Thanks, Mimi.

--
Gustavo

>> ---
>> Changes in v2:
>>  - Update Subject.
>>  - Integrate a missing break in switch fix by Mimi Zohar.
>>
>>  security/apparmor/domain.c                | 2 +-
>>  security/integrity/ima/ima_appraise.c     | 1 +
>>  security/integrity/ima/ima_policy.c       | 4 ++++
>>  security/integrity/ima/ima_template_lib.c | 1 +
>>  security/smack/smack_lsm.c                | 3 +--
>>  5 files changed, 8 insertions(+), 3 deletions(-)
>>
>> diff --git a/security/apparmor/domain.c b/security/apparmor/domain.c
>> index 3b266a438776..ca2dccf5b445 100644
>> --- a/security/apparmor/domain.c
>> +++ b/security/apparmor/domain.c
>> @@ -572,7 +572,7 @@ static struct aa_label *x_to_label(struct aa_profile *profile,
>>  			stack = NULL;
>>  			break;
>>  		}
>> -		/* fall through to X_NAME */
>> +		/* fall through - to X_NAME */
>>  	case AA_X_NAME:
>>  		if (xindex & AA_X_CHILD)
>>  			/* released by caller */
>> diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c
>> index a2baa85ea2f5..5fb7127bbe68 100644
>> --- a/security/integrity/ima/ima_appraise.c
>> +++ b/security/integrity/ima/ima_appraise.c
>> @@ -114,6 +114,7 @@ static void ima_set_cache_status(struct integrity_iint_cache *iint,
>>  		break;
>>  	case CREDS_CHECK:
>>  		iint->ima_creds_status = status;
>> +		break;
>>  	case FILE_CHECK:
>>  	case POST_SETATTR:
>>  		iint->ima_file_status = status;
>> diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
>> index 26fa9d9723f6..e0cc323f948f 100644
>> --- a/security/integrity/ima/ima_policy.c
>> +++ b/security/integrity/ima/ima_policy.c
>> @@ -936,10 +936,12 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
>>  		case Opt_uid_gt:
>>  		case Opt_euid_gt:
>>  			entry->uid_op = &uid_gt;
>> +			/* fall through */
>>  		case Opt_uid_lt:
>>  		case Opt_euid_lt:
>>  			if ((token == Opt_uid_lt) || (token == Opt_euid_lt))
>>  				entry->uid_op = &uid_lt;
>> +			/* fall through */
>>  		case Opt_uid_eq:
>>  		case Opt_euid_eq:
>>  			uid_token = (token == Opt_uid_eq) ||
>> @@ -968,9 +970,11 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
>>  			break;
>>  		case Opt_fowner_gt:
>>  			entry->fowner_op = &uid_gt;
>> +			/* fall through */
>>  		case Opt_fowner_lt:
>>  			if (token == Opt_fowner_lt)
>>  				entry->fowner_op = &uid_lt;
>> +			/* fall through */
>>  		case Opt_fowner_eq:
>>  			ima_log_string_op(ab, "fowner", args[0].from,
>>  					  entry->fowner_op);
>> diff --git a/security/integrity/ima/ima_template_lib.c b/security/integrity/ima/ima_template_lib.c
>> index 43752002c222..513b457ae900 100644
>> --- a/security/integrity/ima/ima_template_lib.c
>> +++ b/security/integrity/ima/ima_template_lib.c
>> @@ -83,6 +83,7 @@ static void ima_show_template_data_ascii(struct seq_file *m,
>>  		/* skip ':' and '\0' */
>>  		buf_ptr += 2;
>>  		buflen -= buf_ptr - field_data->data;
>> +		/* fall through */
>>  	case DATA_FMT_DIGEST:
>>  	case DATA_FMT_HEX:
>>  		if (!buflen)
>> diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
>> index 587dc06eba33..5c1613519d5a 100644
>> --- a/security/smack/smack_lsm.c
>> +++ b/security/smack/smack_lsm.c
>> @@ -3380,13 +3380,12 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode)
>>  		 */
>>  		final = &smack_known_star;
>>  		/*
>> -		 * Fall through.
>> -		 *
>>  		 * If a smack value has been set we want to use it,
>>  		 * but since tmpfs isn't giving us the opportunity
>>  		 * to set mount options simulate setting the
>>  		 * superblock default.
>>  		 */
>> +		/* Fall through */
>>  	default:
>>  		/*
>>  		 * This isn't an understood special case.
> 

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

* Re: [PATCH v2] security: mark expected switch fall-throughs and add a missing break
  2019-02-19  2:53   ` Gustavo A. R. Silva
@ 2019-02-22 17:16     ` Gustavo A. R. Silva
  2019-02-22 17:53       ` James Morris
  0 siblings, 1 reply; 7+ messages in thread
From: Gustavo A. R. Silva @ 2019-02-22 17:16 UTC (permalink / raw)
  To: Mimi Zohar, John Johansen, James Morris, Serge E. Hallyn,
	Dmitry Kasatkin, Casey Schaufler
  Cc: linux-security-module, linux-kernel, linux-integrity, Kees Cook

Hi James,

I wonder if you can take this, please.

Thanks
--
Gustavo

On 2/18/19 8:53 PM, Gustavo A. R. Silva wrote:
> 
> 
> On 2/8/19 3:13 PM, Mimi Zohar wrote:
>> On Fri, 2019-02-08 at 14:54 -0600, Gustavo A. R. Silva wrote:
>>> In preparation to enabling -Wimplicit-fallthrough, mark switch
>>> cases where we are expecting to fall through.
>>>
>>> This patch fixes the following warnings:
>>>
>>> security/integrity/ima/ima_template_lib.c:85:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
>>> security/integrity/ima/ima_policy.c:940:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
>>> security/integrity/ima/ima_policy.c:943:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
>>> security/integrity/ima/ima_policy.c:972:21: warning: this statement may fall through [-Wimplicit-fallthrough=]
>>> security/integrity/ima/ima_policy.c:974:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
>>> security/smack/smack_lsm.c:3391:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
>>> security/apparmor/domain.c:569:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
>>>
>>> Warning level 3 was used: -Wimplicit-fallthrough=3
>>>
>>> Also, add a missing break statement to fix the following warning:
>>>
>>> security/integrity/ima/ima_appraise.c:116:26: warning: this statement may fall through [-Wimplicit-fallthrough=]
>>>
>>> Acked-by: John Johansen <john.johansen@canonical.com>
>>> Acked-by: Casey Schaufler <casey@schaufler-ca.com>
>>> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
>>
>> Acked-by: Mimi Zohar <zohar@linux.ibm.com>
>>
> 
> Thanks, Mimi.
> 
> --
> Gustavo
> 
>>> ---
>>> Changes in v2:
>>>  - Update Subject.
>>>  - Integrate a missing break in switch fix by Mimi Zohar.
>>>
>>>  security/apparmor/domain.c                | 2 +-
>>>  security/integrity/ima/ima_appraise.c     | 1 +
>>>  security/integrity/ima/ima_policy.c       | 4 ++++
>>>  security/integrity/ima/ima_template_lib.c | 1 +
>>>  security/smack/smack_lsm.c                | 3 +--
>>>  5 files changed, 8 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/security/apparmor/domain.c b/security/apparmor/domain.c
>>> index 3b266a438776..ca2dccf5b445 100644
>>> --- a/security/apparmor/domain.c
>>> +++ b/security/apparmor/domain.c
>>> @@ -572,7 +572,7 @@ static struct aa_label *x_to_label(struct aa_profile *profile,
>>>  			stack = NULL;
>>>  			break;
>>>  		}
>>> -		/* fall through to X_NAME */
>>> +		/* fall through - to X_NAME */
>>>  	case AA_X_NAME:
>>>  		if (xindex & AA_X_CHILD)
>>>  			/* released by caller */
>>> diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c
>>> index a2baa85ea2f5..5fb7127bbe68 100644
>>> --- a/security/integrity/ima/ima_appraise.c
>>> +++ b/security/integrity/ima/ima_appraise.c
>>> @@ -114,6 +114,7 @@ static void ima_set_cache_status(struct integrity_iint_cache *iint,
>>>  		break;
>>>  	case CREDS_CHECK:
>>>  		iint->ima_creds_status = status;
>>> +		break;
>>>  	case FILE_CHECK:
>>>  	case POST_SETATTR:
>>>  		iint->ima_file_status = status;
>>> diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
>>> index 26fa9d9723f6..e0cc323f948f 100644
>>> --- a/security/integrity/ima/ima_policy.c
>>> +++ b/security/integrity/ima/ima_policy.c
>>> @@ -936,10 +936,12 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
>>>  		case Opt_uid_gt:
>>>  		case Opt_euid_gt:
>>>  			entry->uid_op = &uid_gt;
>>> +			/* fall through */
>>>  		case Opt_uid_lt:
>>>  		case Opt_euid_lt:
>>>  			if ((token == Opt_uid_lt) || (token == Opt_euid_lt))
>>>  				entry->uid_op = &uid_lt;
>>> +			/* fall through */
>>>  		case Opt_uid_eq:
>>>  		case Opt_euid_eq:
>>>  			uid_token = (token == Opt_uid_eq) ||
>>> @@ -968,9 +970,11 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
>>>  			break;
>>>  		case Opt_fowner_gt:
>>>  			entry->fowner_op = &uid_gt;
>>> +			/* fall through */
>>>  		case Opt_fowner_lt:
>>>  			if (token == Opt_fowner_lt)
>>>  				entry->fowner_op = &uid_lt;
>>> +			/* fall through */
>>>  		case Opt_fowner_eq:
>>>  			ima_log_string_op(ab, "fowner", args[0].from,
>>>  					  entry->fowner_op);
>>> diff --git a/security/integrity/ima/ima_template_lib.c b/security/integrity/ima/ima_template_lib.c
>>> index 43752002c222..513b457ae900 100644
>>> --- a/security/integrity/ima/ima_template_lib.c
>>> +++ b/security/integrity/ima/ima_template_lib.c
>>> @@ -83,6 +83,7 @@ static void ima_show_template_data_ascii(struct seq_file *m,
>>>  		/* skip ':' and '\0' */
>>>  		buf_ptr += 2;
>>>  		buflen -= buf_ptr - field_data->data;
>>> +		/* fall through */
>>>  	case DATA_FMT_DIGEST:
>>>  	case DATA_FMT_HEX:
>>>  		if (!buflen)
>>> diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
>>> index 587dc06eba33..5c1613519d5a 100644
>>> --- a/security/smack/smack_lsm.c
>>> +++ b/security/smack/smack_lsm.c
>>> @@ -3380,13 +3380,12 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode)
>>>  		 */
>>>  		final = &smack_known_star;
>>>  		/*
>>> -		 * Fall through.
>>> -		 *
>>>  		 * If a smack value has been set we want to use it,
>>>  		 * but since tmpfs isn't giving us the opportunity
>>>  		 * to set mount options simulate setting the
>>>  		 * superblock default.
>>>  		 */
>>> +		/* Fall through */
>>>  	default:
>>>  		/*
>>>  		 * This isn't an understood special case.
>>

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

* Re: [PATCH v2] security: mark expected switch fall-throughs and add a missing break
  2019-02-22 17:16     ` Gustavo A. R. Silva
@ 2019-02-22 17:53       ` James Morris
  2019-02-22 22:42         ` Gustavo A. R. Silva
  0 siblings, 1 reply; 7+ messages in thread
From: James Morris @ 2019-02-22 17:53 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Mimi Zohar, John Johansen, Serge E. Hallyn, Dmitry Kasatkin,
	Casey Schaufler, linux-security-module, linux-kernel,
	linux-integrity, Kees Cook

On Fri, 22 Feb 2019, Gustavo A. R. Silva wrote:

> Hi James,
> 
> I wonder if you can take this, please.

Ok -- I had thought you were sending all of these upstream across the 
board.


> 
> Thanks
> --
> Gustavo
> 
> On 2/18/19 8:53 PM, Gustavo A. R. Silva wrote:
> > 
> > 
> > On 2/8/19 3:13 PM, Mimi Zohar wrote:
> >> On Fri, 2019-02-08 at 14:54 -0600, Gustavo A. R. Silva wrote:
> >>> In preparation to enabling -Wimplicit-fallthrough, mark switch
> >>> cases where we are expecting to fall through.
> >>>
> >>> This patch fixes the following warnings:
> >>>
> >>> security/integrity/ima/ima_template_lib.c:85:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
> >>> security/integrity/ima/ima_policy.c:940:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
> >>> security/integrity/ima/ima_policy.c:943:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
> >>> security/integrity/ima/ima_policy.c:972:21: warning: this statement may fall through [-Wimplicit-fallthrough=]
> >>> security/integrity/ima/ima_policy.c:974:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
> >>> security/smack/smack_lsm.c:3391:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
> >>> security/apparmor/domain.c:569:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
> >>>
> >>> Warning level 3 was used: -Wimplicit-fallthrough=3
> >>>
> >>> Also, add a missing break statement to fix the following warning:
> >>>
> >>> security/integrity/ima/ima_appraise.c:116:26: warning: this statement may fall through [-Wimplicit-fallthrough=]
> >>>
> >>> Acked-by: John Johansen <john.johansen@canonical.com>
> >>> Acked-by: Casey Schaufler <casey@schaufler-ca.com>
> >>> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> >>
> >> Acked-by: Mimi Zohar <zohar@linux.ibm.com>
> >>
> > 
> > Thanks, Mimi.
> > 
> > --
> > Gustavo
> > 
> >>> ---
> >>> Changes in v2:
> >>>  - Update Subject.
> >>>  - Integrate a missing break in switch fix by Mimi Zohar.
> >>>
> >>>  security/apparmor/domain.c                | 2 +-
> >>>  security/integrity/ima/ima_appraise.c     | 1 +
> >>>  security/integrity/ima/ima_policy.c       | 4 ++++
> >>>  security/integrity/ima/ima_template_lib.c | 1 +
> >>>  security/smack/smack_lsm.c                | 3 +--
> >>>  5 files changed, 8 insertions(+), 3 deletions(-)
> >>>
> >>> diff --git a/security/apparmor/domain.c b/security/apparmor/domain.c
> >>> index 3b266a438776..ca2dccf5b445 100644
> >>> --- a/security/apparmor/domain.c
> >>> +++ b/security/apparmor/domain.c
> >>> @@ -572,7 +572,7 @@ static struct aa_label *x_to_label(struct aa_profile *profile,
> >>>  			stack = NULL;
> >>>  			break;
> >>>  		}
> >>> -		/* fall through to X_NAME */
> >>> +		/* fall through - to X_NAME */
> >>>  	case AA_X_NAME:
> >>>  		if (xindex & AA_X_CHILD)
> >>>  			/* released by caller */
> >>> diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c
> >>> index a2baa85ea2f5..5fb7127bbe68 100644
> >>> --- a/security/integrity/ima/ima_appraise.c
> >>> +++ b/security/integrity/ima/ima_appraise.c
> >>> @@ -114,6 +114,7 @@ static void ima_set_cache_status(struct integrity_iint_cache *iint,
> >>>  		break;
> >>>  	case CREDS_CHECK:
> >>>  		iint->ima_creds_status = status;
> >>> +		break;
> >>>  	case FILE_CHECK:
> >>>  	case POST_SETATTR:
> >>>  		iint->ima_file_status = status;
> >>> diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
> >>> index 26fa9d9723f6..e0cc323f948f 100644
> >>> --- a/security/integrity/ima/ima_policy.c
> >>> +++ b/security/integrity/ima/ima_policy.c
> >>> @@ -936,10 +936,12 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
> >>>  		case Opt_uid_gt:
> >>>  		case Opt_euid_gt:
> >>>  			entry->uid_op = &uid_gt;
> >>> +			/* fall through */
> >>>  		case Opt_uid_lt:
> >>>  		case Opt_euid_lt:
> >>>  			if ((token == Opt_uid_lt) || (token == Opt_euid_lt))
> >>>  				entry->uid_op = &uid_lt;
> >>> +			/* fall through */
> >>>  		case Opt_uid_eq:
> >>>  		case Opt_euid_eq:
> >>>  			uid_token = (token == Opt_uid_eq) ||
> >>> @@ -968,9 +970,11 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
> >>>  			break;
> >>>  		case Opt_fowner_gt:
> >>>  			entry->fowner_op = &uid_gt;
> >>> +			/* fall through */
> >>>  		case Opt_fowner_lt:
> >>>  			if (token == Opt_fowner_lt)
> >>>  				entry->fowner_op = &uid_lt;
> >>> +			/* fall through */
> >>>  		case Opt_fowner_eq:
> >>>  			ima_log_string_op(ab, "fowner", args[0].from,
> >>>  					  entry->fowner_op);
> >>> diff --git a/security/integrity/ima/ima_template_lib.c b/security/integrity/ima/ima_template_lib.c
> >>> index 43752002c222..513b457ae900 100644
> >>> --- a/security/integrity/ima/ima_template_lib.c
> >>> +++ b/security/integrity/ima/ima_template_lib.c
> >>> @@ -83,6 +83,7 @@ static void ima_show_template_data_ascii(struct seq_file *m,
> >>>  		/* skip ':' and '\0' */
> >>>  		buf_ptr += 2;
> >>>  		buflen -= buf_ptr - field_data->data;
> >>> +		/* fall through */
> >>>  	case DATA_FMT_DIGEST:
> >>>  	case DATA_FMT_HEX:
> >>>  		if (!buflen)
> >>> diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
> >>> index 587dc06eba33..5c1613519d5a 100644
> >>> --- a/security/smack/smack_lsm.c
> >>> +++ b/security/smack/smack_lsm.c
> >>> @@ -3380,13 +3380,12 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode)
> >>>  		 */
> >>>  		final = &smack_known_star;
> >>>  		/*
> >>> -		 * Fall through.
> >>> -		 *
> >>>  		 * If a smack value has been set we want to use it,
> >>>  		 * but since tmpfs isn't giving us the opportunity
> >>>  		 * to set mount options simulate setting the
> >>>  		 * superblock default.
> >>>  		 */
> >>> +		/* Fall through */
> >>>  	default:
> >>>  		/*
> >>>  		 * This isn't an understood special case.
> >>
> 

-- 
James Morris
<jmorris@namei.org>


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

* Re: [PATCH v2] security: mark expected switch fall-throughs and add a missing break
  2019-02-08 20:54 [PATCH v2] security: mark expected switch fall-throughs and add a missing break Gustavo A. R. Silva
  2019-02-08 21:13 ` Mimi Zohar
@ 2019-02-22 17:57 ` James Morris
  1 sibling, 0 replies; 7+ messages in thread
From: James Morris @ 2019-02-22 17:57 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: John Johansen, Serge E. Hallyn, Mimi Zohar, Dmitry Kasatkin,
	Casey Schaufler, linux-security-module, linux-kernel,
	linux-integrity

On Fri, 8 Feb 2019, Gustavo A. R. Silva wrote:

> In preparation to enabling -Wimplicit-fallthrough, mark switch
> cases where we are expecting to fall through.
> 
> This patch fixes the following warnings:
> 
> security/integrity/ima/ima_template_lib.c:85:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
> security/integrity/ima/ima_policy.c:940:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
> security/integrity/ima/ima_policy.c:943:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
> security/integrity/ima/ima_policy.c:972:21: warning: this statement may fall through [-Wimplicit-fallthrough=]
> security/integrity/ima/ima_policy.c:974:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
> security/smack/smack_lsm.c:3391:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
> security/apparmor/domain.c:569:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
> 

Applied to
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git next-general

-- 
James Morris
<jmorris@namei.org>


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

* Re: [PATCH v2] security: mark expected switch fall-throughs and add a missing break
  2019-02-22 17:53       ` James Morris
@ 2019-02-22 22:42         ` Gustavo A. R. Silva
  0 siblings, 0 replies; 7+ messages in thread
From: Gustavo A. R. Silva @ 2019-02-22 22:42 UTC (permalink / raw)
  To: James Morris
  Cc: Mimi Zohar, John Johansen, Serge E. Hallyn, Dmitry Kasatkin,
	Casey Schaufler, linux-security-module, linux-kernel,
	linux-integrity, Kees Cook



On 2/22/19 11:53 AM, James Morris wrote:
> On Fri, 22 Feb 2019, Gustavo A. R. Silva wrote:
> 
>> Hi James,
>>
>> I wonder if you can take this, please.
> 
> Ok -- I had thought you were sending all of these upstream across the 
> board.
> 
> 

Yeah, I'm only doing that in cases where patches are being ignored.

Thanks
--
Gustavo

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

end of thread, back to index

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-08 20:54 [PATCH v2] security: mark expected switch fall-throughs and add a missing break Gustavo A. R. Silva
2019-02-08 21:13 ` Mimi Zohar
2019-02-19  2:53   ` Gustavo A. R. Silva
2019-02-22 17:16     ` Gustavo A. R. Silva
2019-02-22 17:53       ` James Morris
2019-02-22 22:42         ` Gustavo A. R. Silva
2019-02-22 17:57 ` James Morris

Linux-Integrity Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-integrity/0 linux-integrity/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-integrity linux-integrity/ https://lore.kernel.org/linux-integrity \
		linux-integrity@vger.kernel.org linux-integrity@archiver.kernel.org
	public-inbox-index linux-integrity


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-integrity


AGPL code for this site: git clone https://public-inbox.org/ public-inbox