android_kernel_sony_sdm845/include
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Helen Koike 30e402b922 media: v4l2-rect.h: fix v4l2_rect_map_inside() top/left adjustments
commit f51e50db4c20d46930b33be3f208851265694f3e upstream.

boundary->width and boundary->height are sizes relative to
boundary->left and boundary->top coordinates, but they were not being
taken into consideration to adjust r->left and r->top, leading to the
following error:

Consider the follow as initial values for boundary and r:

struct v4l2_rect boundary = {
	.left = 100,
	.top = 100,
	.width = 800,
	.height = 600,
}

struct v4l2_rect r = {
	.left = 0,
	.top = 0,
	.width = 1920,
	.height = 960,
}

calling v4l2_rect_map_inside(&r, &boundary) was modifying r to:

r = {
	.left = 0,
	.top = 0,
	.width = 800,
	.height = 600,
}

Which is wrongly outside the boundary rectangle, because:

	v4l2_rect_set_max_size(r, boundary); // r->width = 800, r->height = 600
	...
	if (r->left + r->width > boundary->width) // true
		r->left = boundary->width - r->width; // r->left = 800 - 800
	if (r->top + r->height > boundary->height) // true
		r->top = boundary->height - r->height; // r->height = 600 - 600

Fix this by considering top/left coordinates from boundary.

Fixes: ac49de8c49 ("[media] v4l2-rect.h: new header with struct v4l2_rect helper functions")
Signed-off-by: Helen Koike <helen.koike@collabora.com>
Cc: <stable@vger.kernel.org>      # for v4.7 and up
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-14 16:31:00 -05:00
..
acpi ACPICA: Reference Counts: increase max to 0x4000 for large servers 2019-03-19 13:14:07 +01:00
asm-generic asm-generic: fix -Wtype-limits compiler warnings 2019-08-25 10:51:50 +02:00
clocksource
crypto crypto: vmac - separate tfm and request context 2018-08-17 20:59:29 +02:00
drm drm: mst: Fix query_payload ack reply struct 2020-01-04 13:39:00 +01:00
dt-bindings dt-bindings: reset: meson8b: fix duplicate reset IDs 2020-01-23 08:19:38 +01:00
keys KEYS: user: Align the payload buffer 2019-02-27 10:07:00 +01:00
kvm arm/arm64: KVM: Add PSCI version selection API 2018-05-09 09:50:19 +02:00
linux USB: serial: ir-usb: fix link-speed handling 2020-02-05 13:05:35 +00:00
math-emu math-emu/soft-fp.h: (_FP_ROUND_ZERO) cast 0 to void to fix warning 2019-12-21 10:41:02 +01:00
media media: v4l2-rect.h: fix v4l2_rect_map_inside() top/left adjustments 2020-02-14 16:31:00 -05:00
memory
misc
net cfg80211/mac80211: make ieee80211_send_layer2_update a public function 2020-01-23 08:19:34 +01:00
pcmcia
ras
rdma IB/mlx4: Avoid implicit enumerated type conversion 2019-11-25 09:53:28 +01:00
rxrpc
scsi scsi: target: iscsi: Wait for all commands to finish before freeing a session 2020-01-04 13:41:01 +01:00
soc memory: tegra: Apply interrupts mask per SoC 2018-08-03 07:55:24 +02:00
sound ALSA: timer: Limit max instances per timer 2019-11-06 12:18:28 +01:00
target target: Avoid early CMD_T_PRE_EXECUTE failures during ABORT_TASK 2018-01-17 09:38:54 +01:00
trace tracing: xen: Ordered comparison of function pointers 2020-01-29 10:24:39 +01:00
uapi net: ethtool: Add back transceiver type 2020-01-29 10:24:36 +01:00
video udlfb: set optimal write delay 2018-09-09 20:01:25 +02:00
xen swiotlb-xen: implement xen_swiotlb_dma_mmap callback 2017-10-05 09:44:05 +02:00
Kbuild