No description
Find a file
Helen Koike 48d8bba5e9 media: v4l2-rect.h: fix v4l2_rect_map_inside() top/left adjustments
commit f51e50db4c 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:32:08 -05:00
arch sparc32: fix struct ipc64_perm type definition 2020-02-14 16:32:06 -05:00
block block: don't use bio->bi_vcnt to figure out segment number 2020-01-27 14:46:19 +01:00
certs Replace magic for trusting the secondary keyring with #define 2018-09-09 19:55:54 +02:00
crypto crypto: pcrypt - Fix user-after-free on module unload 2020-02-05 14:18:11 +00:00
Documentation PM / devfreq: Add new name attribute for sysfs 2020-02-05 14:18:12 +00:00
drivers media/v4l2-core: set pages dirty upon releasing DMA buffers 2020-02-14 16:32:08 -05:00
firmware Fix built-in early-load Intel microcode alignment 2020-01-23 08:20:30 +01:00
fs btrfs: do not zero f_bavail if we have available space 2020-02-05 14:18:29 +00:00
include media: v4l2-rect.h: fix v4l2_rect_map_inside() top/left adjustments 2020-02-14 16:32:08 -05:00
init fork: fix some -Wmissing-prototypes warnings 2019-12-05 15:37:52 +01:00
ipc ipc/mqueue.c: only perform resource calculation if user valid 2019-08-06 19:05:24 +02:00
kernel tracing: Fix sched switch start/stop refcount racy updates 2020-02-14 16:32:07 -05:00
lib bitmap: Add bitmap_alloc(), bitmap_zalloc() and bitmap_free() 2020-01-29 15:02:39 +01:00
mm mm/mempolicy.c: fix out of bounds write in mpol_parse_str() 2020-02-05 14:18:13 +00:00
net rxrpc: Fix NULL pointer deref due to call->conn being cleared on disconnect 2020-02-14 16:32:07 -05:00
samples samples: bpf: fix syscall_tp due to unused syscall 2020-01-12 12:11:56 +01:00
scripts ARM: 8950/1: ftrace/recordmcount: filter relocation types 2020-01-29 15:02:37 +01:00
security keys: Timestamp new keys 2020-01-27 14:46:19 +01:00
sound ALSA: dummy: Fix PCM format loop in proc output 2020-02-14 16:32:08 -05:00
tools perf report: Fix no libunwind compiled warning break s390 issue 2020-02-05 14:18:29 +00:00
usr kbuild: clean compressed initramfs image 2019-10-07 18:55:14 +02:00
virt KVM: arm/arm64: vgic: Don't rely on the wrong pending table 2019-12-17 20:38:51 +01:00
.cocciconfig
.get_maintainer.ignore
.gitattributes .gitattributes: set git diff driver for C source code files 2016-10-07 18:46:30 -07:00
.gitignore kbuild: rpm-pkg: keep spec file until make mrproper 2018-02-13 10:19:46 +01:00
.mailmap .mailmap: Add Maciej W. Rozycki's Imagination e-mail address 2017-11-10 12:16:15 -08:00
COPYING
CREDITS MAINTAINERS: update TPM driver infrastructure changes 2017-11-09 17:58:40 -08:00
Kbuild License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Kconfig License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
MAINTAINERS USB: rio500: Remove Rio 500 kernel driver 2019-10-17 13:43:20 -07:00
Makefile Linux 4.14.170 2020-02-05 14:18:29 +00:00
README README: add a new README file, pointing to the Documentation/ 2016-10-24 08:12:35 -02:00

Linux kernel
============

This file was moved to Documentation/admin-guide/README.rst

Please notice that there are several guides for kernel developers and users.
These guides can be rendered in a number of formats, like HTML and PDF.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.
See Documentation/00-INDEX for a list of what is contained in each file.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.