If we know that TARGET_PAGE_SIZE=2^k, it will indeed divide sz iff sz has no power of two lower than k in its binary representation (e.g, if in decomposition to primes, sz=2^m*p1^a1*p2^a2... , where m>=k).

But in this case the equivalent of the condition in the code above would be:
        if (!newhmr->sz || (newhmr->sz & (TARGET_PAGE_SIZE-1)) { /* handle error */ }

As originally specified, and not like the last one. Anyway Mark's original seems fine to me.