History

[media] v4l2_plane_pix_format: use __u32 bytesperline instead of __u16

While running v4l2-compliance tests on vivid I suddenly got errors due to a call to vmalloc_user with size 0 from vb2. Digging deeper into the cause I discovered that this was due to the fact that struct v4l2_plane_pix_format defines bytesperline as a __u16 instead of a __u32. The test I was running selected a format of 4 * 4096 by 4 * 2048 with a 32 bit pixelformat. So bytesperline was 4 * 4 * 4096 = 65536, which becomes 0 in a __u16. And bytesperline * height is suddenly 0 as well. While the vivid driver may be a virtual driver, it is to be expected that this limit will be hit for real hardware as well in the near future: 8k deep-color video will already reach it. The solution is to change the type to __u32. The only drivers besides vivid that use the multiplanar API are little-endian ARM and SH platforms (exynos, ti-vpe, vsp1), so this is safe.

Hans Verkuil committed 11 years ago

Commit cc7d2df1 parent 03c278f3 files · +5 −5Browse files

Showing the changes to include/uapi (1 of 3 files). Show all

Unified · Split

include/uapi/linux/videodev2.h+2−2
@@ -1842,8 +1842,8 @@ struct v4l2_mpeg_vbi_fmt_ivtv { · 1841 unmodified lines
18421842 */
18431843 struct v4l2_plane_pix_format {
18441844 __u32 sizeimage;
1845− __u16 bytesperline;
1846− __u16 reserved[7];
1845+ __u32 bytesperline;
1846+ __u16 reserved[6];
18471847 } __attribute__ ((packed));
18481848
18491849 /**

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t