The dedicated ES-52 hood is 52mm in diameter, and looks to be about 6mm deep. The front element of the 40/2.8 is about 17mm in diameter, meaning the hood is about about 17mm from the edges of the front element all around.

Ok, I guesstimated the 6mm depth. Let's be conservative and say its a full 1 cm deep. With 26mm radius and 10mm height, the acute angle at the top of the hood is 21 degrees. Double that and subtract that product from 180 degrees, and the hood with that geometry will optimally protect from flare on a lens with a 138 degree AoV. The 40mm lens has a 57 degree AoV on FF. The ES-52 hood, based on a conservative 1cm depth estimate, is too shallow to protect even a 14mm lens from flare.

FWIW, one user reported that the ES-62 hood with its 52mm threaded adapter, a much deeper hood, does not vignette on the 40mm pancake on a FF camera.

I must say - I really have to question the optical utility of the hood. It's utility as a profitable item for Canon - that, I don't question at all.