  The discrepancy between the weak lensing (WL) and the {\it Planck}
measurements of $S_8$ has been a subject of several studies. These studies tend
to show that a suppression of the amplitude of the mass power spectrum $P(k)$
at high $k$ could resolve it. The WL signal at small-scale is sensitive to
various effects, such as baryonic effects and intrinsic alignment. The accuracy
of $P(k)$ depends on the modelling precision of these effects. A common
approach for calculating $P(k)$ relies on a halo model. Amongst the various
components necessary for the construction of $P(k)$, the halo mass function
(HMF) is an important one. Traditionally, the HMF has been assumed to follow a
fixed model. Recent literature shows that baryonic physics, amongst several
other factors, could affect the HMF. In this study, we investigate the impact
of allowing the HMF to vary. This provides a way of testing the validity of the
halo model-HMF calibration using data. We find that the {\it Planck} cosmology
is not compatible with the vanilla HMF for both the DES-y3 and the KiDS-1000
data. When the cosmology and the HMF parameters are allowed to vary, the {\it
Planck} cosmology is no longer in tension. The modified HMF predicts a matter
power spectrum with a $\sim 25\%$ power loss at $k\sim 1~{\rm h/Mpc}$, in
agreement with the recent studies. We show that Stage IV surveys will be able
to measure the HMF parameters with a few percent accuracy.
