[PATCH v3 2/2] PCI/IOV: set iov->num_VFs before VFs are probed

2024-02-14 Thread Jim Harris
Ensure userspace can see the updated number of VFs via sysfs sriov_numvfs before those VFs are probed. Suggested-by: Leon Romanovsky Signed-off-by: Jim Harris --- drivers/pci/iov.c |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c

[PATCH v3 1/2] PCI/IOV: Revert "PCI/IOV: Serialize sysfs sriov_numvfs reads vs writes"

2024-02-14 Thread Jim Harris
If an SR-IOV enabled device is held by vfio, and the device is removed, vfio will hold device lock and notify userspace of the removal. If userspace reads the sriov_numvfs sysfs entry, that thread will be blocked since sriov_numvfs_show() also tries to acquire the device lock. If that same thread i

[PATCH v3 0/2] PCI/IOV: sriov_numvfs bug fixes

2024-02-14 Thread Jim Harris
A deadlock condition was discovered by SPDK when removing an SRIOV-enabled and VFIO-attached device, with a specific threading model. While discussing this on the mailing list, a separate issue around updating sriov_numvfs and its kobject_uevent() was also discovered. This series fixes both of thos

[PATCH v7 2/3] overflow: Introduce wrapping_add(), wrapping_sub(), and wrapping_mul()

2024-02-14 Thread Kees Cook
Provide helpers that will perform wrapping addition, subtraction, or multiplication without tripping the arithmetic wrap-around sanitizers. The first argument is the type under which the wrap-around should happen with. In other words, these two calls will get very different results: wrappi

[PATCH v7 1/3] overflow: Adjust check_*_overflow() kern-doc to reflect results

2024-02-14 Thread Kees Cook
The check_*_overflow() helpers will return results with potentially wrapped-around values. These values have always been checked by the selftests, so avoid the confusing language in the kern-doc. The idea of "safe for use" was relative to the expectation of whether or not the caller wants a wrapped

[PATCH v7 3/3] overflow: Introduce wrapping_assign_add() and wrapping_assign_sub()

2024-02-14 Thread Kees Cook
This allows replacements of the idioms "var += offset" and "var -= offset" with the wrapping_assign_add() and wrapping_assign_sub() helpers respectively. They will avoid wrap-around sanitizer instrumentation. Add to the selftests to validate behavior and lack of side-effects. Signed-off-by: Kees

[PATCH v7 0/3] overflow: Introduce wrapping helpers

2024-02-14 Thread Kees Cook
v7: - further kern-doc cleanups (Mark) v6: https://lore.kernel.org/all/20240213220844.it.345-k...@kernel.org/ v5: https://lore.kernel.org/all/20240207152317.do.560-k...@kernel.org/ v4: https://lore.kernel.org/all/20240206102354.make.081-k...@kernel.org/ v3: https://lore.kernel.org/all/2024020509085

Re: [PATCH v6 1/3] overflow: Adjust check_*_overflow() kern-doc to reflect results

2024-02-14 Thread Kees Cook
On Wed, Feb 14, 2024 at 11:57:28AM +, Mark Rutland wrote: > On Tue, Feb 13, 2024 at 02:10:57PM -0800, Kees Cook wrote: > > The check_*_overflow() helpers will return results with potentially > > wrapped-around values. These values have always been checked by the > > selftests, so avoid the conf

Re: Coverity: __do_sys_pidfd_send_signal(): UNINIT

2024-02-14 Thread Oleg Nesterov
On 02/14, Tycho Andersen wrote: > > On Wed, Feb 14, 2024 at 06:55:55PM +0100, Oleg Nesterov wrote: > > > > We want to check the "flags" argument at the start, we do not want to > > delay the "case 0:" check until we have f.file (so that we can check > > f.file->f_flags). > > Fair point. I was think

Re: [PATCH] lib/string_choices: Add str_plural() helper

2024-02-14 Thread Kees Cook
On Wed, Feb 14, 2024 at 08:49:39PM +0200, Andy Shevchenko wrote: > On Wed, Feb 14, 2024 at 08:30:53PM +0200, Jani Nikula wrote: > > On Wed, 14 Feb 2024, Andy Shevchenko > > wrote: > > > On Wed, Feb 14, 2024 at 08:08:16PM +0200, Andy Shevchenko wrote: > > >> On Wed, Feb 14, 2024 at 05:50:15PM +010

Re: Coverity: __do_sys_pidfd_send_signal(): UNINIT

2024-02-14 Thread Kees Cook
On Tue, Feb 13, 2024 at 05:18:01PM -0700, Tycho Andersen wrote: > On Tue, Feb 13, 2024 at 03:59:37PM -0800, coverity-bot wrote: > > Hello! > > > > This is an experimental semi-automated report about issues detected by > > Coverity from a scan of next-20240213 as part of the linux-next scan > > pr

Re: [PATCH] lib/string_choices: Add str_plural() helper

2024-02-14 Thread Andy Shevchenko
On Wed, Feb 14, 2024 at 08:30:53PM +0200, Jani Nikula wrote: > On Wed, 14 Feb 2024, Andy Shevchenko > wrote: > > On Wed, Feb 14, 2024 at 08:08:16PM +0200, Andy Shevchenko wrote: > >> On Wed, Feb 14, 2024 at 05:50:15PM +0100, Michal Wajdeczko wrote: > >> > Add str_plural() helper to replace existi

Re: Coverity: __do_sys_pidfd_send_signal(): UNINIT

2024-02-14 Thread Tycho Andersen
On Wed, Feb 14, 2024 at 06:55:55PM +0100, Oleg Nesterov wrote: > Hi Tycho, > > let me repeat just in case, I am fine either way, whatever you and > Christian prefer. In particular, I agree in advance if you decide > to not change the current code, it is correct even if it can fool > the tools. >

Re: [PATCH] lib/string_choices: Add str_plural() helper

2024-02-14 Thread Jani Nikula
On Wed, 14 Feb 2024, Andy Shevchenko wrote: > On Wed, Feb 14, 2024 at 08:08:16PM +0200, Andy Shevchenko wrote: >> On Wed, Feb 14, 2024 at 05:50:15PM +0100, Michal Wajdeczko wrote: >> > Add str_plural() helper to replace existing open implementations >> > used by many drivers and help improve futur

Re: [PATCH] lib/string_choices: Add str_plural() helper

2024-02-14 Thread Andy Shevchenko
On Wed, Feb 14, 2024 at 08:08:16PM +0200, Andy Shevchenko wrote: > On Wed, Feb 14, 2024 at 05:50:15PM +0100, Michal Wajdeczko wrote: > > Add str_plural() helper to replace existing open implementations > > used by many drivers and help improve future user facing messages. > > Any user of this, ple

Re: [PATCH] lib/string_choices: Add str_plural() helper

2024-02-14 Thread Andy Shevchenko
On Wed, Feb 14, 2024 at 05:50:15PM +0100, Michal Wajdeczko wrote: > Add str_plural() helper to replace existing open implementations > used by many drivers and help improve future user facing messages. Any user of this, please? > Signed-off-by: Michal Wajdeczko > Cc: Andy Shevchenko > Cc: Jani

Re: Coverity: __do_sys_pidfd_send_signal(): UNINIT

2024-02-14 Thread Oleg Nesterov
Hi Tycho, let me repeat just in case, I am fine either way, whatever you and Christian prefer. In particular, I agree in advance if you decide to not change the current code, it is correct even if it can fool the tools. That said, On 02/14, Tycho Andersen wrote: > > On Wed, Feb 14, 2024 at 10:06

[PATCH] lib/string_choices: Add str_plural() helper

2024-02-14 Thread Michal Wajdeczko
Add str_plural() helper to replace existing open implementations used by many drivers and help improve future user facing messages. Signed-off-by: Michal Wajdeczko Cc: Andy Shevchenko Cc: Jani Nikula --- include/linux/string_choices.h | 5 + 1 file changed, 5 insertions(+) diff --git a/in

Re: Coverity: __do_sys_pidfd_send_signal(): UNINIT

2024-02-14 Thread Tycho Andersen
On Wed, Feb 14, 2024 at 10:06:41AM +0100, Oleg Nesterov wrote: > On 02/14, Oleg Nesterov wrote: > > > > On 02/13, Tycho Andersen wrote: > > > > > > I think this is a false positive, we have: > > > > Agreed, > > > > > That said, a default case wouldn't hurt, and we should fix the first > > > comment

Re: [PATCH] sh: Fix build with CONFIG_UBSAN=y

2024-02-14 Thread John Paul Adrian Glaubitz
Hi Kees, On Mon, 2024-02-12 at 19:45 +0100, John Paul Adrian Glaubitz wrote: > On Mon, 2024-02-12 at 10:26 -0800, Kees Cook wrote: > > > I just wanted to try reproduce the problem again with the reproducer in > > > [1] as well > > > as with gcc-13.2.0, but your branch devel/overflow/ubsan-only no

Re: [PATCH v6 2/3] overflow: Introduce wrapping_add(), wrapping_sub(), and wrapping_mul()

2024-02-14 Thread Mark Rutland
On Tue, Feb 13, 2024 at 02:10:58PM -0800, Kees Cook wrote: > Provide helpers that will perform wrapping addition, subtraction, or > multiplication without tripping the arithmetic wrap-around sanitizers. The > first argument is the type under which the wrap-around should happen > with. In other word

Re: [PATCH v6 1/3] overflow: Adjust check_*_overflow() kern-doc to reflect results

2024-02-14 Thread Mark Rutland
On Tue, Feb 13, 2024 at 02:10:57PM -0800, Kees Cook wrote: > The check_*_overflow() helpers will return results with potentially > wrapped-around values. These values have always been checked by the > selftests, so avoid the confusing language in the kern-doc. The idea of > "safe for use" was relat

[PATCH v6 162/164] pwm: Ensure a struct pwm has the same lifetime as its pwm_chip

2024-02-14 Thread Uwe Kleine-König
It's required to not free the memory underlying a requested PWM while a consumer still has a reference to it. While currently a pwm_chip doesn't life long enough in all cases, linking the struct pwm to the pwm_chip results in the right lifetime as soon as the pwmchip is living long enough. This hap

[PATCH v4 2/3] ARM: tegra: Add device-tree for LG Optimus Vu (P895)

2024-02-14 Thread Svyatoslav Ryhel
Add device-tree for LG Optimus Vu P895, which is a NVIDIA Tegra30-based smartphone, originally running Android. Signed-off-by: Svyatoslav Ryhel --- arch/arm/boot/dts/nvidia/Makefile|1 + arch/arm/boot/dts/nvidia/tegra30-lg-p895.dts | 496 + arch/arm/boot/dts/nvidia/tegra30-l

[PATCH v4 3/3] ARM: tegra: Add device-tree for LG Optimus 4X HD (P880)

2024-02-14 Thread Svyatoslav Ryhel
Add device-tree for LG Optimus 4X HD P880, which is a NVIDIA Tegra30-based smartphone, originally running Android. Signed-off-by: Svyatoslav Ryhel --- arch/arm/boot/dts/nvidia/Makefile| 1 + arch/arm/boot/dts/nvidia/tegra30-lg-p880.dts | 489 +++ 2 files changed, 49

[PATCH v4 1/3] dt-bindings: arm: tegra: Add LG Optimus Vu P895 and Optimus 4X P880

2024-02-14 Thread Svyatoslav Ryhel
From: Maxim Schwalm Add a compatible for the LG Optimus Vu P895 and Optimus 4X P880. Signed-off-by: Maxim Schwalm Signed-off-by: Svyatoslav Ryhel Acked-by: Krzysztof Kozlowski --- Documentation/devicetree/bindings/arm/tegra.yaml | 8 1 file changed, 8 insertions(+) diff --git a/Doc

[PATCH v4 0/3] Tegra30: add support for LG tegra based phones

2024-02-14 Thread Svyatoslav Ryhel
Bring up Tegra 3 based LG phones Optimus 4X HD and Optimus Vu based on LG X3 board. --- Changes from v3: - set max77663 ldo0 to be always on since it is required by the SOC - adjusted bluetooth module comment - added enable gpio to dw9714 focuser Changes from v2: - switched from _ to - in node na

Re: Coverity: __do_sys_pidfd_send_signal(): UNINIT

2024-02-14 Thread Oleg Nesterov
On 02/14, Oleg Nesterov wrote: > > On 02/13, Tycho Andersen wrote: > > > > I think this is a false positive, we have: > > Agreed, > > > That said, a default case wouldn't hurt, and we should fix the first > > comment anyways, since now we have extensions. > > > > I'm happy to send a patch or maybe

Re: Coverity: __do_sys_pidfd_send_signal(): UNINIT

2024-02-14 Thread Oleg Nesterov
On 02/13, Tycho Andersen wrote: > > I think this is a false positive, we have: Agreed, > That said, a default case wouldn't hurt, and we should fix the first > comment anyways, since now we have extensions. > > I'm happy to send a patch or maybe it's better for Christian to fix it > in-tree. I l