Please keep in mind that the bayer image may have padding at the end of each row in order to align the line start with 16 or 32 byte boundary. This padding is done by the ISP when it receives the image from the camera.
For example, a number of common raw resolutions have the line stride listed in the FindFrameSize function in voxl-camera-server source code: