In Hosmer and Lemeshow's 1980 paper, Theorem 2 states that the asymptotic distribution of $\hat{C}^*_g$ (the usual Hosmer-Lemeshow test statistic) is \begin{equation} \tag{1} \chi^2_{2g-g-(p+1)} + \sum_{i=1}^{p+1} \lambda_i \chi^2_i(1), \end{equation} where the $\lambda_i$ are eigenvalues of a matrix (specified in the paper, not relevant to this question). Then, they show through simulations that $\sum_{i=1}^{p+1} \lambda_i \chi^2_i(1)$ is approximately $\chi^2_{p-1}$, which leads to the usual $g-2$ degrees of freedom in the Hosmer-Lemeshow test.
This makes sense, except for the fact that from Moore and Spruill's (1975) Theorem 5, shouldn't the distribution of the statistic be $$ \chi^2_{M-m-1} + \sum_{i=1}^{p+1} \lambda_i \chi^2_i(1),$$ where $M=2g$, and $m=p+1$? I don't see how Hosmer and Lemeshow got the $2g-g-(p+1)$ degrees of freedom on the first term in (1).