msm: ipa3: adding check for holb stats

Adding null checks while getting the holb stats

Change-Id: Iba83cd86522679137f66fa1e7844884955fecf4d
Signed-off-by: Veerendra Kumar Kamsali <quic_veekum@quicinc.com>
This commit is contained in:
Veerendra Kumar Kamsali
2022-10-26 11:14:04 +05:30
committed by Gerrit - the friendly Code Review server
parent 757a544d71
commit e739dfa5ab

View File

@@ -229,6 +229,7 @@ static int ipa_get_generic_stats(unsigned long arg)
return res; return res;
} }
if(ipa_lnx_agent_ctx.alloc_info.num_holb_drop_stats_clients != 0 ) {
/* HOLB Discard stats */ /* HOLB Discard stats */
holb_disc_stats_ptr = &generic_stats->holb_stats.holb_disc_stats[0]; holb_disc_stats_ptr = &generic_stats->holb_stats.holb_disc_stats[0];
for (i = 0; i < IPA_CLIENT_MAX; i++) { for (i = 0; i < IPA_CLIENT_MAX; i++) {
@@ -250,7 +251,9 @@ static int ipa_get_generic_stats(unsigned long arg)
holb_disc_stats_ptr = (struct holb_discard_stats *)(( holb_disc_stats_ptr = (struct holb_discard_stats *)((
uint64_t)holb_disc_stats_ptr + sizeof(struct holb_discard_stats)); uint64_t)holb_disc_stats_ptr + sizeof(struct holb_discard_stats));
} }
}
if(ipa_lnx_agent_ctx.alloc_info.num_holb_mon_stats_clients != 0 ) {
/* HOLB Monitor stats */ /* HOLB Monitor stats */
holb_mon_stats_ptr = (struct holb_monitor_stats *)( holb_mon_stats_ptr = (struct holb_monitor_stats *)(
(uint64_t)&generic_stats->holb_stats.holb_disc_stats[0] + (uint64_t)&generic_stats->holb_stats.holb_disc_stats[0] +
@@ -271,6 +274,7 @@ static int ipa_get_generic_stats(unsigned long arg)
holb_mon_stats_ptr = (struct holb_monitor_stats *)(( holb_mon_stats_ptr = (struct holb_monitor_stats *)((
uint64_t)holb_mon_stats_ptr + sizeof(struct holb_monitor_stats)); uint64_t)holb_mon_stats_ptr + sizeof(struct holb_monitor_stats));
} }
}
if(copy_to_user((void __user *)arg, if(copy_to_user((void __user *)arg,
(u8 *)generic_stats, (u8 *)generic_stats,