mirror of
				https://github.com/torvalds/linux.git
				synced 2025-10-31 16:48:26 +02:00 
			
		
		
		
	audit: use struct_size() helper in audit_[send|make]_reply()
Make use of struct_size() helper instead of an open-coded calculation. Link: https://github.com/KSPP/linux/issues/160 Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
This commit is contained in:
		
							parent
							
								
									8f110f5306
								
							
						
					
					
						commit
						30561b51cc
					
				
					 2 changed files with 2 additions and 2 deletions
				
			
		|  | @ -1459,7 +1459,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | ||||||
| 			security_release_secctx(ctx, len); | 			security_release_secctx(ctx, len); | ||||||
| 		} | 		} | ||||||
| 		audit_send_reply(skb, seq, AUDIT_SIGNAL_INFO, 0, 0, | 		audit_send_reply(skb, seq, AUDIT_SIGNAL_INFO, 0, 0, | ||||||
| 				 sig_data, sizeof(*sig_data) + len); | 				 sig_data, struct_size(sig_data, ctx, len)); | ||||||
| 		kfree(sig_data); | 		kfree(sig_data); | ||||||
| 		break; | 		break; | ||||||
| 	case AUDIT_TTY_GET: { | 	case AUDIT_TTY_GET: { | ||||||
|  |  | ||||||
|  | @ -1092,7 +1092,7 @@ static void audit_list_rules(int seq, struct sk_buff_head *q) | ||||||
| 				break; | 				break; | ||||||
| 			skb = audit_make_reply(seq, AUDIT_LIST_RULES, 0, 1, | 			skb = audit_make_reply(seq, AUDIT_LIST_RULES, 0, 1, | ||||||
| 					       data, | 					       data, | ||||||
| 					       sizeof(*data) + data->buflen); | 					       struct_size(data, buf, data->buflen)); | ||||||
| 			if (skb) | 			if (skb) | ||||||
| 				skb_queue_tail(q, skb); | 				skb_queue_tail(q, skb); | ||||||
| 			kfree(data); | 			kfree(data); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Xiu Jianfeng
						Xiu Jianfeng