mirror of
				git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
				synced 2025-11-01 09:13:37 +00:00 
			
		
		
		
	stm class: Replace zero-length array with flexible-array
There is a regular need in the kernel to provide a way to declare having a dynamically sized set of trailing elements in a structure. Kernel code should always use “flexible array members”[1] for these cases. The older style of one-element or zero-length arrays should no longer be used[2]. [1] https://en.wikipedia.org/wiki/Flexible_array_member [2] https://github.com/KSPP/linux/issues/21 Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
This commit is contained in:
		
							parent
							
								
									b2b32e3aa0
								
							
						
					
					
						commit
						e35635000f
					
				
					 2 changed files with 3 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -34,7 +34,7 @@ struct stp_policy_node {
 | 
			
		|||
	unsigned int		first_channel;
 | 
			
		||||
	unsigned int		last_channel;
 | 
			
		||||
	/* this is the one that's exposed to the attributes */
 | 
			
		||||
	unsigned char		priv[0];
 | 
			
		||||
	unsigned char		priv[];
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void *stp_policy_node_priv(struct stp_policy_node *pn)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,7 +23,7 @@ void *stp_policy_node_priv(struct stp_policy_node *pn);
 | 
			
		|||
 | 
			
		||||
struct stp_master {
 | 
			
		||||
	unsigned int	nr_free;
 | 
			
		||||
	unsigned long	chan_map[0];
 | 
			
		||||
	unsigned long	chan_map[];
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct stm_device {
 | 
			
		||||
| 
						 | 
				
			
			@ -42,7 +42,7 @@ struct stm_device {
 | 
			
		|||
	const struct config_item_type		*pdrv_node_type;
 | 
			
		||||
	/* master allocation */
 | 
			
		||||
	spinlock_t		mc_lock;
 | 
			
		||||
	struct stp_master	*masters[0];
 | 
			
		||||
	struct stp_master	*masters[];
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#define to_stm_device(_d)				\
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue