mirror of
				https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
				synced 2025-11-03 21:43:32 +00:00 
			
		
		
		
	meas_rep.c: clang reports a possible division by zero
Check the input and exit early if we have no measurement reports to avoid a possible division by zero.
This commit is contained in:
		@@ -76,6 +76,9 @@ int get_meas_rep_avg(const struct gsm_lchan *lchan,
 | 
				
			|||||||
	unsigned int i, idx;
 | 
						unsigned int i, idx;
 | 
				
			||||||
	int avg = 0;
 | 
						int avg = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (num < 1)
 | 
				
			||||||
 | 
							return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
 | 
						idx = calc_initial_idx(ARRAY_SIZE(lchan->meas_rep),
 | 
				
			||||||
				lchan->meas_rep_idx, num);
 | 
									lchan->meas_rep_idx, num);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user