Re: [PATCH] iio: adc: meson-saradc: Variables could be uninitalized if regmap_read() fails

2019-09-28 Thread Nicholas Mc Guire
return value of regmap_read() should be > checked and handled. > > Signed-off-by: Yizhuo Just a few minor style issues - contentwise it look correct to me. Reviewed-by: Nicholas Mc Guire > --- > drivers/iio/adc/meson_saradc.c | 28 +++- > 1 fil

Re: [PATCH] staging: bcm2835-camera: Avoid apotential sleep while holding a spin_lock

2019-06-24 Thread Nicholas Mc Guire
h a > struct idr.") The GFP_KERNEL actually was there befor this patch so not sure if this Fixes ref is correct - I think the GFP_KERNEL was introduced in: 4e6bafdfb9f3 ("staging: bcm2835_camera: Use a mapping table for context field of mmal_msg_header") > Signed-off-by: Christ

[PATCH] rtc: ds2404: use hw endiannes variable

2019-05-08 Thread Nicholas Mc Guire
the generated binary (x86_64 and ppc64 binary diff). Signed-off-by: Nicholas Mc Guire --- Problem located by an experimental coccinelle script to locate patters that make sparse unhappy (false positives): on little-endian x86_64 sparse complains about: drivers/rtc/rtc-ds2404.c:187:16: warning: cast

[PATCH] i2c: tegra: use busendiannes variable

2019-05-08 Thread Nicholas Mc Guire
change due to limit on instruction re-ordering induced by the additional constraint. Signed-off-by: Nicholas Mc Guire --- Problem located by an experimental coccinelle script to locate patters that make sparse unhappy (false positives): sparse was complaining about: drivers/i2c/busses/i2c-tegra.c

Re: [PATCH RFC] selinux: provide __le variables explicitly

2019-05-08 Thread Nicholas Mc Guire
On Wed, May 08, 2019 at 05:47:32PM -0400, Paul Moore wrote: > On Wed, May 8, 2019 at 2:27 AM Nicholas Mc Guire wrote: > > While the endiannes is being handled properly sparse was unable to verify > > this due to type inconsistency. So introduce an additional __le32 > > respec

[PATCH RFC] selinux: provide __le variables explicitly

2019-05-08 Thread Nicholas Mc Guire
binary on little-endian systems - on 32bit powerpc it does change the binary. Signed-off-by: Nicholas Mc Guire --- Problem located by an experimental coccinelle script to locate patters that make sparse unhappy (false positives): sparse complaints on different architectures fixed by this patch

Re: [PATCH] staging: greybus: use proper return type for wait_for_completion_timeout

2019-04-30 Thread Nicholas Mc Guire
On Tue, Apr 30, 2019 at 12:58:21PM +0300, Dan Carpenter wrote: > On Sat, Apr 27, 2019 at 05:27:25AM +0200, Nicholas Mc Guire wrote: > > wait_for_completion_timeout() returns unsigned long (0 on timeout or > > remaining jiffies) not int. > > > > Yeah, but it's fine

Re: [PATCH V2] staging: fieldbus: anybus-s: force endiannes annotation

2019-04-29 Thread Nicholas Mc Guire
On Tue, Apr 30, 2019 at 04:02:23AM +0100, Al Viro wrote: > On Tue, Apr 30, 2019 at 04:22:38AM +0200, Nicholas Mc Guire wrote: > > On Mon, Apr 29, 2019 at 10:03:36AM -0400, Sven Van Asbroeck wrote: > > > On Mon, Apr 29, 2019 at 2:11 AM Nicholas Mc Guire > > >

Re: [PATCH V2] staging: fieldbus: anybus-s: force endiannes annotation

2019-04-29 Thread Nicholas Mc Guire
On Mon, Apr 29, 2019 at 10:03:36AM -0400, Sven Van Asbroeck wrote: > On Mon, Apr 29, 2019 at 2:11 AM Nicholas Mc Guire wrote: > > > > V2: As requested by Sven Van Asbroeck make the > > impact of the patch clear in the commit message. > > Thank you, but did you mis

Re: [PATCH] net_sched: force endianness annotation

2019-04-29 Thread Nicholas Mc Guire
On Mon, Apr 29, 2019 at 12:11:18PM +0100, Edward Cree wrote: > On 29/04/2019 11:44, Nicholas Mc Guire wrote: > > be16_to_cpu((__force __be16)val) should be a NOP on big-endian as well > Yes.  But it's semiotically wrong to call be16_to_cpu() on a cpu-endian >  value; if the exi

[PATCH V2] staging: fieldbus: anybus-s: force endiannes annotation

2019-04-29 Thread Nicholas Mc Guire
While the endiannes is being handled correctly sparse was unhappy with the missing annotation as be16_to_cpu() expects a __be16. The __force cast to __be16 makes sparse happy but has no impact on the generated binary. Signed-off-by: Nicholas Mc Guire --- Problem reported by sparse V2

[PATCH V3] staging: fieldbus: anybus-s: consolidate wait_for_completion_timeout return handling

2019-04-29 Thread Nicholas Mc Guire
introducing an additional unsigned long variable. Along with fixing this type inconsistency the fall-through if is consolidated to a single if-block. Signed-off-by: Nicholas Mc Guire --- Problem located with experimental API conformance checking cocci script V3: As requested by Sven Van Asbroeck

[PATCH V2] staging: fieldbus: anybus-s: consolidate wait_for_completion_timeout return handling

2019-04-27 Thread Nicholas Mc Guire
wait_for_completion_timeout() returns unsigned long (0 on timeout or remaining jiffies) not int - so rather than introducing an additional variable simply wrap the completion into an if(). Signed-off-by: Nicholas Mc Guire --- Problem located with experimental API conformance checking cocci

[PATCH] staging: fieldbus: anybus-s: force endiannes annotation

2019-04-27 Thread Nicholas Mc Guire
While the endiannes is being handled correctly sparse was unhappy with the missing annotation as be16_to_cpu() expects a __be16. Signed-off-by: Nicholas Mc Guire --- Problem reported by sparse As far as I understand sparse here the __force is actually the only solution possible to inform

Re: [PATCH RFC] staging: fieldbus: anybus-s: use proper type for wait_for_completion_timeout

2019-04-27 Thread Nicholas Mc Guire
On Sat, Apr 27, 2019 at 03:20:54AM -0400, Sven Van Asbroeck wrote: > On Sat, Apr 27, 2019 at 3:01 AM Nicholas Mc Guire wrote: > > > > (some unrelated sparse warnings (cast to restricted __be16)) > > > > > > That sounds interesting too. Could you provide more deta

[PATCH RFC V2] staging: kpc2000: use int for wait_for_completion_interruptible

2019-04-27 Thread Nicholas Mc Guire
weit_for_completion_interruptible returns in (0 on completion and -ERESTARTSYS on interruption) - so use an int not long for API conformance and simplify the logic here a bit: need not check explicitly for == 0 as this is either -ERESTARTSYS or 0. Signed-off-by: Nicholas Mc Guire --- Problem

Re: [PATCH RFC] staging: fieldbus: anybus-s: use proper type for wait_for_completion_timeout

2019-04-27 Thread Nicholas Mc Guire
On Sat, Apr 27, 2019 at 02:17:42AM -0400, Sven Van Asbroeck wrote: > Hello Nicholas, thank you for your contribution, I really appreciate it ! > See inline comments below. > > On Sat, Apr 27, 2019 at 12:32 AM Nicholas Mc Guire wrote: > > > > wait_for_completion_timeout()

[PATCH RFC] staging: fieldbus: anybus-s: use proper type for wait_for_completion_timeout

2019-04-26 Thread Nicholas Mc Guire
wait_for_completion_timeout() returns unsigned long (0 on timeout or remaining jiffies) not int. thus there is no negative case to check for here. Signed-off-by: Nicholas Mc Guire --- Problem located with experimental API conformance checking cocci script Q: It is not really clear

[PATCH] staging: greybus: use proper return type for wait_for_completion_timeout

2019-04-26 Thread Nicholas Mc Guire
wait_for_completion_timeout() returns unsigned long (0 on timeout or remaining jiffies) not int. Signed-off-by: Nicholas Mc Guire --- Problem located with experimental API conformance checking cocci script Patch was compile-tested with: x86_64_defconfig + GREYBUS=m Patch is against 5.1-rc6

[PATCH RFC] staging: kpc2000: use int for wait_for_completion_interruptible

2019-04-26 Thread Nicholas Mc Guire
weit_for_completion_interruptible returns in (0 on completion and -ERESTARTSYS on interruption) - so use an int not long for API conformance and simplify the logic here a bit: need not check explicitly for == 0 as this is either -ERESTARTSYS or 0. Signed-off-by: Nicholas Mc Guire --- Problem

[PATCH V2] staging: vc04_services: handle kzalloc failure

2019-04-18 Thread Nicholas Mc Guire
then will fail with -EINVAL. Signed-off-by: Nicholas Mc Guire Reported-by: kbuild test robot --- Problem located with experimental coccinelle script V2: The != VCHIQ_SUCCES went unnoticed not clear how I did that as building drivers/staging/vc04_services/vchiq.o seemed to have succeeded

[PATCH RFC] staging: vc04_services: handle kzalloc failure

2019-04-18 Thread Nicholas Mc Guire
then will fail with -EINVAL. Signed-off-by: Nicholas Mc Guire --- Problem located with experimental coccinelle script Patch was compile-tested with: bcm2835_defconfig (implies BCM2835_VCHIQ=m) (with sparse warning: CHECK drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c

Re: [PATCH V2] ARM: mvebu: at least report the kzalloc failure

2019-04-17 Thread Nicholas Mc Guire
On Wed, Apr 17, 2019 at 02:07:44PM +0200, Gregory CLEMENT wrote: > Hi Nicholas, > > Nicholas Mc Guire writes: > > > On Tue, Apr 16, 2019 at 03:39:57PM +0200, Andrew Lunn wrote: > >> On Tue, Apr 16, 2019 at 05:56:31AM +0200, Nicholas Mc Guire wrote: > >>

Re: [PATCH V2] ARM: mvebu: at least report the kzalloc failure

2019-04-17 Thread Nicholas Mc Guire
On Tue, Apr 16, 2019 at 03:39:57PM +0200, Andrew Lunn wrote: > On Tue, Apr 16, 2019 at 05:56:31AM +0200, Nicholas Mc Guire wrote: > > > Note that this will trigger a checkpatch WARNING > > "WARNING: Possible unnecessary 'out of memory' message" > > but comparin

[PATCH] MAINTAINERS: add soc/ux500

2019-04-15 Thread Nicholas Mc Guire
get_maintainer.pl only returns linux-kernel@vger.kernel.org for the drivers/soc/ux500/ files - fix it by adding drivers/soc/ux500/ entry Signed-off-by: Nicholas Mc Guire Suggested-by: Ulf Hansson --- Patch is aginst 5.1-rc4 (localversion-next is 20190415) MAINTAINERS | 1 + 1 file changed, 1

[PATCH V2] ARM: imx legacy: warn on failed allocation

2019-04-15 Thread Nicholas Mc Guire
Even in init the allocation can fail and thus should report by pr_err() so that the cause can be easily identified. Signed-off-by: Nicholas Mc Guire Link: https://lkml.org/lkml/2019/4/14/152 --- Problem located with an experimental coccinelle script V2: Russell King pointed out that the use

[PATCH V2] ARM: mvebu: at least report the kzalloc failure

2019-04-15 Thread Nicholas Mc Guire
Although it is very unlikely that the allocation during init would fail any such failure should point to the original cause to allow easier understanding of the ensuing null-pointer dereference splat. Signed-off-by: Nicholas Mc Guire --- Problem located with experimental coccinelle script V2

Re: [PATCH 1/3 RFC] ARM: mvebu: at least warn on kzalloc failure

2019-04-14 Thread Nicholas Mc Guire
On Sun, Apr 14, 2019 at 06:26:02PM +0100, Russell King - ARM Linux admin wrote: > On Sun, Apr 14, 2019 at 06:49:49AM +0200, Nicholas Mc Guire wrote: > > Although it is very unlikely that the allocation during init would > > fail any such failure should point to the original cause

Re: [PATCH 3/3] ARM: mvebu: add SPDX license identifier

2019-04-14 Thread Nicholas Mc Guire
On Sun, Apr 14, 2019 at 06:22:10PM +0200, Andrew Lunn wrote: > On Sun, Apr 14, 2019 at 06:49:51AM +0200, Nicholas Mc Guire wrote: > > The license is clearly identified as GPL V2 - so just add in the > > appropriate SPDX license identifier. > > > > Signed-off-by:

[PATCH 3/3] ARM: mvebu: add SPDX license identifier

2019-04-13 Thread Nicholas Mc Guire
The license is clearly identified as GPL V2 - so just add in the appropriate SPDX license identifier. Signed-off-by: Nicholas Mc Guire --- Problem reported by checkpatch WARNING: Missing or malformed SPDX-License-Identifier tag in line 1 #1: FILE: arch/arm/mach-mvebu/board-v7.c:1: +/* Patch

[PATCH 1/3 RFC] ARM: mvebu: at least warn on kzalloc failure

2019-04-13 Thread Nicholas Mc Guire
Although it is very unlikely that the allocation during init would fail any such failure should point to the original cause rather than waiting for a null-pointer dereference to splat. Signed-off-by: Nicholas Mc Guire --- Problem located with experimental coccinelle script While

[PATCH 2/3] ARM: mvebu: drop return from void function

2019-04-13 Thread Nicholas Mc Guire
The return statement is unnecessary here - so drop it. Signed-off-by: Nicholas Mc Guire --- Problem reported by checkpatch WARNING: void function return statements are not generally useful #141: FILE: arch/arm/mach-mvebu/board-v7.c:141: + return; +} Patch was compile-tested

Re: [PATCH 4/4] ARM: imx legacy: add an SPDX license identifier

2019-04-13 Thread Nicholas Mc Guire
On Sat, Apr 13, 2019 at 11:11:05AM -0300, Fabio Estevam wrote: > On Sat, Apr 13, 2019 at 4:30 AM Nicholas Mc Guire wrote: > > > > The header clearly identifies this code as GPL V2 or later - so pop > > in the SPDX license identifier. > > > > Signed-off-by: Nichola

[PATCH 1/4 RFC] ARM: imx legacy: warn on failed allocation

2019-04-13 Thread Nicholas Mc Guire
Even in init the allocation can fail and thus should at least warn so that the cause can be identified. Signed-off-by: Nicholas Mc Guire --- Problem located with an experimental coccinelle script Note sure if there is a better solution as this is early in the boot process so not that could

[PATCH 0/4] ARM: imx legacy: cleanups

2019-04-13 Thread Nicholas Mc Guire
Sorry for the noise - I accidentally sent out a set of old patches along with this cleanups set. Only the ARM: imx legacy: should have goon out. While preparing a proposed fix for a missing check on zmalloc a few other checkpatch warnings poped up - this little set fixes those warnings. There is

[PATCH 4/4] ARM: imx legacy: add an SPDX license identifier

2019-04-13 Thread Nicholas Mc Guire
The header clearly identifies this code as GPL V2 or later - so pop in the SPDX license identifier. Signed-off-by: Nicholas Mc Guire --- arch/arm/mach-imx/mach-mx27ads.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-imx/mach-mx27ads.c b/arch/arm/mach-imx/mach-mx27ads.c index

[PATCH 3/4 RFC] ARM: imx legacy: wrap complex macro in ()

2019-04-13 Thread Nicholas Mc Guire
Checkpatch suggests to place a parenthesis around this complex macro. Signed-off-by: Nicholas Mc Guire --- Problem reported by checkpatch I'm actually not sure this really is improving readability but by default checkpatch gets it right so... Patch was compile-tested with: imx_v4_v5_defconfig

[PATCH 2/4] ARM: imx legacy: declare unsigned int rather than unsigned

2019-04-13 Thread Nicholas Mc Guire
provide the proper type for unsigned int. Signed-off-by: Nicholas Mc Guire --- Problem reported by checkpatch Patch was compile-tested with: imx_v4_v5_defconfig (implies CONFIG_MACH_MX27ADS=y) Patch is against 5.1-rc4 (localversion-next is 20190412) arch/arm/mach-imx/mach-mx27ads.c | 4

[PATCH 2/3] ARM: hisi: check of_iomap and fix missing of_node_put

2019-04-13 Thread Nicholas Mc Guire
a check seems mandated here. Signed-off-by: Nicholas Mc Guire 0002 Fixes: commit 06cc5c1d4d73 ("ARM: hisi: enable hix5hd2 SoC") --- Problem found by an experimental coccinelle script Patch was compile tested with: hisi_defconfig (implies CONFIG_SMP=y) Patch is against 4.18-rc3 (localve

[PATCH] ARM: imx: flag failure of of_iomap

2019-04-13 Thread Nicholas Mc Guire
imx_set_aips is assuming that the address returned from of_iomap is valid which it probably is in the normal case - as the call site is void error propagation is not possible but never the less at least a WARN_ON() seems warranted here. Signed-off-by: Nicholas Mc Guire Fixes: commit

[PATCH] ARM: STi: at least warn if of_iomap fails

2019-04-13 Thread Nicholas Mc Guire
The call to of_iomap() is unchecked but scu_enable(), which the returned address is passed on to, assumes a valid mapping. If the mapping is invalid this could probably lead to undefined system state so at least a warning should be issued. Signed-off-by: Nicholas Mc Guire Fixes: commit

[PATCH 1/4 RFC] ARM: imx legacy: warn on failed allocation

2019-04-13 Thread Nicholas Mc Guire
Even in init the allocation can fail and thus should at least warn so that the cause can be identified. Signed-off-by: Nicholas Mc Guire --- Problem located with an experimental coccinelle script Note sure if there is a better solution as this is early in the boot process so not that could

[PATCH 3/3] ARM: hisi: handle of_iomap and fix missing of_node_put

2019-04-13 Thread Nicholas Mc Guire
Relying on an unchecked of_iomap() which can return NULL is problematic here, an explicit check seems mandatory. Also the call to of_find_compatible_node() returns a device node with refcount incremented therefor an explicit of_node_put() is needed here. Signed-off-by: Nicholas Mc Guire Fixes

[PATCH V2] ARM: STi: warn if scu mapping fails

2019-04-13 Thread Nicholas Mc Guire
If the device node is not found or the of_iomap() failed, calling scu_enable would not be safe and could lead to an undefined system state. So warn in both failure paths before returning. Signed-off-by: Nicholas Mc Guire Link: http://lkml.org/lkml/2018/7/16/219 Fixes: commit 65ebcc115889 (&quo

[PATCH 3/4 RFC] ARM: imx legacy: wrap complex macro in ()

2019-04-13 Thread Nicholas Mc Guire
Checkpatch suggests to place a parenthesis around this complex macro. Signed-off-by: Nicholas Mc Guire --- Problem reported by checkpatch I'm actually not sure this really is improving readability but by default checkpatch gets it right so... Patch was compile-tested with: imx_v4_v5_defconfig

[PATCH 4/4] ARM: imx legacy: add an SPDX license identifier

2019-04-13 Thread Nicholas Mc Guire
The header clearly identifies this code as GPL V2 or later - so pop in the SPDX license identifier. Signed-off-by: Nicholas Mc Guire --- arch/arm/mach-imx/mach-mx27ads.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-imx/mach-mx27ads.c b/arch/arm/mach-imx/mach-mx27ads.c index

[PATCH 2/4] ARM: imx legacy: declare unsigned int rather than unsigned

2019-04-13 Thread Nicholas Mc Guire
provide the proper type for unsigned int. Signed-off-by: Nicholas Mc Guire --- Problem reported by checkpatch Patch was compile-tested with: imx_v4_v5_defconfig (implies CONFIG_MACH_MX27ADS=y) Patch is against 5.1-rc4 (localversion-next is 20190412) arch/arm/mach-imx/mach-mx27ads.c | 4

[PATCH] ARM: ux500: add missing of_node_put()

2019-04-13 Thread Nicholas Mc Guire
of_find_compatible_node() returns a pointer with refcount incremented so both in the error path as well as after usage in soc_info_populate() respectively actually b8500_read_soc_id() an explicit of_node_put is needed to release backupram. Signed-off-by: Nicholas Mc Guire Fixes: commit

[PATCH 0/4] ARM: imx legacy: cleanups

2019-04-13 Thread Nicholas Mc Guire
While preparing a proposed fix for a missing check on zmalloc a few other checkpatch warnings poped up - this little set fixes those warnings. There is one remaining checkpatch warning but that looks like a false-positive to me: ERROR: Use of __initconst requires a separate use of const #171:

[PATCH] ARM: u300: add missing check for kmalloc

2019-04-13 Thread Nicholas Mc Guire
kmalloc return for bigrxbuf_virtual was not being checked - in case of failure set status, cleanup bigtxbuf_virtual and baile out. Signed-off-by: Nicholas Mc Guire Fixes: c7c8c78fdf6e ("ARM: 5667/3: U300 SSP/SPI board setup and test") --- Issue found with experimental coccine

[PATCH] ARM: add missing of_node_put()

2019-04-13 Thread Nicholas Mc Guire
The call to of_find_compatible_node() returns a node pointer with refcount incremented thus it must be explicitly decremented here after the last usage. (see drivers/of/base.c:of_find_compatible_node()) Signed-off-by: Nicholas Mc Guire --- Problem located with an experimental coccinelle script

[PATCH 0/3] ARM: hisi: fix of_iomap errors

2019-04-13 Thread Nicholas Mc Guire
This patch set addresses two issues in arch/arm/mach-hisi/hotplug.c 1) The hisi hotplug functions were using a few unchecked of_iomap() while at the same time the system relied on those mappings. Checks for !NULL were inserted. 2) Further some mandatory of_node_put() were missing and have

[PATCH 1/3] ARM: hisi: fix error handling and missing of_node_put

2019-04-13 Thread Nicholas Mc Guire
of_iomap() can return NULL which seems critical here and thus should be explicitly flagged so that the cause of system halting can be understood. As of_find_compatible_node() is returning a device node with refcount incremented it must be explicitly decremented here. Signed-off-by: Nicholas Mc

Re: [PATCH RFC] clk: ux500: add range to usleep_range

2019-04-11 Thread Nicholas Mc Guire
On Thu, Apr 11, 2019 at 06:12:49AM -0700, Joe Perches wrote: > On Thu, 2019-04-11 at 14:59 +0200, Nicholas Mc Guire wrote: > > On Thu, Apr 11, 2019 at 04:51:25AM -0700, Joe Perches wrote: > > > On Thu, 2019-04-11 at 04:56 +0200, Nicholas Mc Guire wrote: > > > > On W

Re: [PATCH RFC] clk: ux500: add range to usleep_range

2019-04-11 Thread Nicholas Mc Guire
On Thu, Apr 11, 2019 at 04:51:25AM -0700, Joe Perches wrote: > On Thu, 2019-04-11 at 04:56 +0200, Nicholas Mc Guire wrote: > > On Wed, Apr 10, 2019 at 03:53:51PM -0700, Stephen Boyd wrote: > > > Quoting Nicholas Mc Guire (2019-04-06 20:13:24) > > > > Providing a r

[PATCH V2] clk: ux500: add range to usleep_range

2019-04-11 Thread Nicholas Mc Guire
for hrtimer optimization. Signed-off-by: Nicholas Mc Guire --- Problem located with an experimental coccinelle script V2: As clarified by Ulf Hansson the delays here are typically in the millisecond range - so as proposed replace the factor 2 by a 25

Re: [PATCH RFC] clk: ux500: add range to usleep_range

2019-04-11 Thread Nicholas Mc Guire
On Thu, Apr 11, 2019 at 11:36:45AM +0200, Ulf Hansson wrote: > On Sun, 7 Apr 2019 at 05:13, Nicholas Mc Guire wrote: > > > > Providing a range for usleep_range() allows the hrtimer subsystem to > > coalesce timers - the delay is runtime configurable so a factor 2 > > is

Re: [PATCH RFC] clk: ux500: add range to usleep_range

2019-04-10 Thread Nicholas Mc Guire
On Wed, Apr 10, 2019 at 03:53:51PM -0700, Stephen Boyd wrote: > Quoting Nicholas Mc Guire (2019-04-06 20:13:24) > > Providing a range for usleep_range() allows the hrtimer subsystem to > > coalesce timers - the delay is runtime configurable so a factor 2 > > is taken

[PATCH RFC] clk: ux500: add range to usleep_range

2019-04-06 Thread Nicholas Mc Guire
Providing a range for usleep_range() allows the hrtimer subsystem to coalesce timers - the delay is runtime configurable so a factor 2 is taken to provide the range. Signed-off-by: Nicholas Mc Guire --- Problem located with an experimental coccinelle script

[PATCH] ASoC: ab8500: add range to usleep_range

2019-04-06 Thread Nicholas Mc Guire
Providing a range for usleep_range() allows the hrtimer subsystem to coalesce timers - as this delay has no upper limit anyway (interrupts or context switch is possible) it should not hurt to extend this from 2 to 2-4 milliseconds. Signed-off-by: Nicholas Mc Guire --- Problem located

[PATCH 1/2] staging:iio:accel:adis16203: add SPDX license identifier tag

2019-04-03 Thread Nicholas Mc Guire
Pop in the SPDX tag as the license is clearly indicated as GPL V2 or later this should also be indicated with a SPDX license identifier tag. Signed-off-by: Nicholas Mc Guire --- chackpatch.pl was warning: WARNING: Missing or malformed SPDX-License-Identifier tag in line 1 Patch was compile

[PATCH 2/2] staging:iio:accel:adis16240: add SPDX license identifier tag

2019-04-03 Thread Nicholas Mc Guire
Pop in the SPDX tag as the license is clearly indicated as GPL V2 or later this should also be indicated with a SPDX license identifier tag. Signed-off-by: Nicholas Mc Guire --- chackpatch.pl was warning: WARNING: Missing or malformed SPDX-License-Identifier tag in line 1 Patch was compile

Re: [PATCH] staging: rtlwifi: Use proper enum for return in halmac_parse_psd_data_88xx

2019-02-20 Thread Nicholas Mc Guire
loc return or bail") > Link: https://github.com/ClangBuiltLinux/linux/issues/375 > Signed-off-by: Nathan Chancellor Reviewed-by: Nicholas Mc Guire > --- > drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_func_88xx.c | 2 +- > 1 file changed, 1 insertion(+), 1 delet

[PATCH] staging: r8822be: check kzalloc return or bail

2019-02-15 Thread Nicholas Mc Guire
The kzalloc() in halmac_parse_psd_data_88xx() can fail and return NULL so check the psd_set->data after allocation and if allocation failed return HALMAC_CMD_PROCESS_ERROR. Signed-off-by: Nicholas Mc Guire Fixes: 938a0447f094 ("staging: r8822be: Add code for halmac sub-drive")

[PATCH V2] sysfs.txt: add note on available attribute macros

2019-02-14 Thread Nicholas Mc Guire
to mode 0666 will fail respectively revert to 0664. Signed-off-by: Nicholas Mc Guire --- V2: the descriptions were not too helpful as noted by Greg Kroah-Hartman so lets see if V2 is any better... Documentation/filesystems/sysfs.txt | 21 + 1 file changed, 21

[PATCH RFC] sysfs.txt: add note on available attribute macros

2019-02-14 Thread Nicholas Mc Guire
0666 will fail. Signed-off-by: Nicholas Mc Guire --- Note quite sure if this is the right place to place the note on mode 0666 but it should be somewhere as any attempt to set 0666 will be reverted to 0664. Documentation/filesystems/sysfs.txt | 16 1 file changed, 16 insertions

Re: [PATCH V4] livepatch: non static warnings fix

2019-01-27 Thread Nicholas Mc Guire
On Fri, Jan 25, 2019 at 04:44:18PM +0100, Jiri Kosina wrote: > On Thu, 24 Jan 2019, Nicholas Mc Guire wrote: > > > Sparse reported warnings about non-static symbols. For the variables > > a simple static attribute is fine - for the functions referenced by > > livepatch

Re: [PATCH RFC] iw_cxgb4: drop check - dead code

2019-01-23 Thread Nicholas Mc Guire
On Wed, Jan 23, 2019 at 12:45:11PM -0600, Steve Wise wrote: > > > On 1/23/2019 12:30 PM, Jason Gunthorpe wrote: > > On Sun, Jan 20, 2019 at 02:27:13AM +0100, Nicholas Mc Guire wrote: > >> The kmalloc is called with | __GFP_NOFAIL so there is no point in > &

[PATCH V4] livepatch: non static warnings fix

2019-01-23 Thread Nicholas Mc Guire
attribute to the shared statically declared functions. Signed-off-by: Nicholas Mc Guire Suggested-by: Joe Lawrence Acked-by: Miroslav Benes Link: https://lore.kernel.org/lkml/1544965657-26804-1-git-send-email-hof...@osadl.org/ --- V2: not all static functions shared need to carry the __noclone

Re: [PATCH V3] livepatch: non static warnings fix

2019-01-23 Thread Nicholas Mc Guire
On Wed, Jan 23, 2019 at 03:30:57PM +0100, Miroslav Benes wrote: > Hi, > > On Wed, 23 Jan 2019, Nicholas Mc Guire wrote: > > > Sparse reported warnings about non-static symbols. For the variables > > a simple static attribute is fine - for the functions referenced by &g

[PATCH] livepatch: fix size mismatch

2019-01-23 Thread Nicholas Mc Guire
kzalloc(sizeof(int)) is called for an int object but then passed into klp_shadow_alloc() using the size of the pointer. This probably is not a problem as it will fit - but it should be cleaned (after all this is reference code). Signed-off-by: Nicholas Mc Guire --- Reported by coccicheck

[PATCH V3] livepatch: non static warnings fix

2019-01-22 Thread Nicholas Mc Guire
attribute to the shared statically declared functions. Signed-off-by: Nicholas Mc Guire Suggested-by: Joe Lawrence Link: https://lkml.org/lkml/2018/12/13/827 --- V2: not all static functions shared need to carry the __noclone attribute only those that need to be resolved at runtime

Re: [PATCH V2] livepatch: fix non-static warnings

2019-01-22 Thread Nicholas Mc Guire
On Tue, Jan 22, 2019 at 11:30:30AM -0500, Joe Lawrence wrote: > On 12/18/18 10:18 AM, Joe Lawrence wrote: > >On 12/18/2018 03:49 AM, Miroslav Benes wrote: > >>On Mon, 17 Dec 2018, Joe Lawrence wrote: > >> > >>>I'm just being picky about its documentation and how we should note its > >>>usage in

[PATCH] media: cx23885: check allocation return

2019-01-19 Thread Nicholas Mc Guire
Checking of kmalloc() seems to have been committed - as cx23885_dvb_register() is checking for != 0 return, returning -ENOMEM should be fine here. While at it address the coccicheck suggestion to move to kmemdup rather than using kmalloc+memcpy. Signed-off-by: Nicholas Mc Guire Fixes

[PATCH RFC] iw_cxgb4: drop check - dead code

2019-01-19 Thread Nicholas Mc Guire
of __GFP_NOFAIL should be only in exceptional cases as I understand it and alloc_srq_queue() is called in quite a few places) In either way it would need fixing. Signed-off-by: Nicholas Mc Guire Fixes: 6a0b6174d35a ("rdma/cxgb4: Add support for kernel mode SRQ's") --- Found during code rev

Re: [PATCH] soc: fsl: guts: us devm_kstrdup_const() for RO data

2019-01-10 Thread Nicholas Mc Guire
On Thu, Jan 10, 2019 at 01:43:01PM -0600, Li Yang wrote: > On Sat, Dec 22, 2018 at 2:02 AM Nicholas Mc Guire wrote: > > > > On Fri, Dec 21, 2018 at 08:29:56PM -0600, Scott Wood wrote: > > > On Fri, 2018-12-07 at 09:22 +0100, Nicholas Mc Guire wrote: > > >

Re: [PATCH RFC] mm: vmalloc: do not allow kzalloc to fail

2018-12-24 Thread Nicholas Mc Guire
On Mon, Dec 24, 2018 at 10:38:04AM +0100, Nicholas Mc Guire wrote: > On Mon, Dec 24, 2018 at 09:10:56AM +0100, Michal Hocko wrote: > > On Sat 22-12-18 09:04:21, Nicholas Mc Guire wrote: > > > On Fri, Dec 21, 2018 at 01:58:39PM -0800, David Rientjes wrote: > > > > On

Re: [PATCH RFC] mm: vmalloc: do not allow kzalloc to fail

2018-12-24 Thread Nicholas Mc Guire
On Mon, Dec 24, 2018 at 09:10:56AM +0100, Michal Hocko wrote: > On Sat 22-12-18 09:04:21, Nicholas Mc Guire wrote: > > On Fri, Dec 21, 2018 at 01:58:39PM -0800, David Rientjes wrote: > > > On Thu, 20 Dec 2018, Nicholas Mc Guire wrote: > > > > > > > d

Re: [PATCH RFC] mm: vmalloc: do not allow kzalloc to fail

2018-12-22 Thread Nicholas Mc Guire
On Fri, Dec 21, 2018 at 01:58:39PM -0800, David Rientjes wrote: > On Thu, 20 Dec 2018, Nicholas Mc Guire wrote: > > > diff --git a/mm/vmalloc.c b/mm/vmalloc.c > > index 871e41c..1c118d7 100644 > > --- a/mm/vmalloc.c > > +++ b/mm/vmalloc.c > > @@ -1258,7 +125

Re: [PATCH] soc: fsl: guts: us devm_kstrdup_const() for RO data

2018-12-22 Thread Nicholas Mc Guire
On Fri, Dec 21, 2018 at 08:29:56PM -0600, Scott Wood wrote: > On Fri, 2018-12-07 at 09:22 +0100, Nicholas Mc Guire wrote: > > devm_kstrdup() may return NULL if internal allocation failed, but > > as machine is from the device tree, and thus RO, devm_kstrdup_const() > > ca

[PATCH RFC] mm: vmalloc: do not allow kzalloc to fail

2018-12-20 Thread Nicholas Mc Guire
seems to have been a check for NULL return. So if this is expected to never fail should it not be using | __GFP_NOFAIL here ? Or put differently - what is the rational for GFP_NOWAIT to be safe here ? Signed-off-by: Nicholas Mc Guire Fixes 43ebdac42f16 ("vmalloc: use kzalloc() instead of alloc_bo

[PATCH] cifs: handle allocation failures early

2018-12-19 Thread Nicholas Mc Guire
kzalloc can return NULL so a check is needed. Further move the allocation checks before the remaining initialization and bail out without initialization if allocation failed returning NULL. Signed-off-by: Joe Perches Signed-off-by: Nicholas Mc Guire Fixes: 3d4ef9a15343 ("smb3: fix redu

Re: [PATCH] cifs: check kzalloc return

2018-12-18 Thread Nicholas Mc Guire
On Tue, Dec 18, 2018 at 09:33:58AM -0800, Joe Perches wrote: > On Tue, 2018-12-18 at 17:27 +0100, Nicholas Mc Guire wrote: > > kzalloc can return NULL so a check is needed. While there is a > > check for ret_buf there is no check for the allocation of > > ret_buf->crfid.

[PATCH] cifs: check kzalloc return

2018-12-18 Thread Nicholas Mc Guire
ems appropriate. As the kzalloc() is the only thing here that can fail it is moved to the beginning so as not to initialize other resources on failure of kzalloc. Signed-off-by: Nicholas Mc Guire Fixes: 3d4ef9a15343 ("smb3: fix redundant opens on root") --- Problem located with an

Re: [PATCH V2] livepatch: fix non-static warnings

2018-12-17 Thread Nicholas Mc Guire
On Mon, Dec 17, 2018 at 10:44:36AM -0500, Joe Lawrence wrote: > On 12/17/2018 07:03 AM, Miroslav Benes wrote: > > Hi, > > > > I'm sorry for being late to the party. > > > > On Sun, 16 Dec 2018, Nicholas Mc Guire wrote: > > > >> S

[PATCH V2] livepatch: fix non-static warnings

2018-12-16 Thread Nicholas Mc Guire
declared functions. Signed-off-by: Nicholas Mc Guire Suggested-by: Joe Lawrence Link: https://lkml.org/lkml/2018/12/13/827 --- V2: not all static functions shared need to carry the __noclone attribute only those that need to be resolved at runtime by livepatch - so drop the unnecessary

Re: [PATCH 1/2] livepatch: fix non-static warnings

2018-12-15 Thread Nicholas Mc Guire
On Fri, Dec 14, 2018 at 04:34:23PM -0500, Joe Lawrence wrote: > On 12/14/2018 11:56 AM, Nicholas Mc Guire wrote: > > Sparse reported warnings about non-static symbols. For the variables a > > simple static attribute is fine - for those symbols referenced by > > livepatch vi

[PATCH 1/2] livepatch: fix non-static warnings

2018-12-14 Thread Nicholas Mc Guire
) is used for the statically declared functions. Signed-off-by: Nicholas Mc Guire Link: https://lkml.org/lkml/2018/12/13/827 --- sparse reported the following warnings: CHECK samples/livepatch/livepatch-shadow-fix1.c samples/livepatch/livepatch-shadow-fix1.c:74:14: warning: symbol

[PATCH 2/2] livepatch: check kzalloc return values

2018-12-14 Thread Nicholas Mc Guire
-by: Nicholas Mc Guire Fixes: 439e7271dc2b ("livepatch: introduce shadow variable API") --- Problem located with an experimental coccinelle script Patch was compile tested with: x86_64_defconfig + FTRACE=y FUNCTION_TRACER=y, EXPERT=y, LATENCYTOP=y, SAMPLES=y, SAMPLE_LIVEPATCH=y Patch is ag

Re: [PATCH 2/2 V2] livepatch: handle kzalloc failure properly

2018-12-13 Thread Nicholas Mc Guire
On Thu, Dec 13, 2018 at 11:39:25AM -0500, Joe Lawrence wrote: > On 12/13/2018 10:39 AM, Nicholas Mc Guire wrote: > > On Thu, Dec 13, 2018 at 09:14:18AM -0500, Joe Lawrence wrote: > >> On 12/13/2018 09:05 AM, Nicholas Mc Guire wrote: > >>> kzalloc() return sho

Re: [PATCH 2/2 V2] livepatch: handle kzalloc failure properly

2018-12-13 Thread Nicholas Mc Guire
On Thu, Dec 13, 2018 at 09:14:18AM -0500, Joe Lawrence wrote: > On 12/13/2018 09:05 AM, Nicholas Mc Guire wrote: > > kzalloc() return should be checked. On dummy_alloc() failing > > in kzalloc() NULL should be returned. > > > > Signed-off-by: Nicholas Mc Guir

[PATCH 2/2 V2] livepatch: handle kzalloc failure properly

2018-12-13 Thread Nicholas Mc Guire
kzalloc() return should be checked. On dummy_alloc() failing in kzalloc() NULL should be returned. Signed-off-by: Nicholas Mc Guire --- Problem was located with an experimental coccinelle script V2: returning NULL is ok but not without cleanup - thanks to Petr Mladek for catching

[PATCH 1/2 V2] livepatch: handle kzalloc failure properly

2018-12-13 Thread Nicholas Mc Guire
kzalloc() return should always be checked - notably in example code where this may be seen as reference. On failure of allocation livepatch_fix1_dummy_alloc() should return NULL. Signed-off-by: Nicholas Mc Guire --- Problem was located with an experimental coccinelle script V2: ...and since

Re: [PATCH 1/2] livepatch: handle kzalloc failure

2018-12-13 Thread Nicholas Mc Guire
On Thu, Dec 13, 2018 at 01:31:39PM +0100, Petr Mladek wrote: > On Thu 2018-12-13 12:09:49, Nicholas Mc Guire wrote: > > kzalloc() return should always be checked - notably in example code > > where this may be seen as reference. On failure of allocation > > livepatch_fix1

[PATCH 2/2] livepatch: handle kzalloc failure

2018-12-13 Thread Nicholas Mc Guire
kzalloc() return should be checked. On dummy_alloc() failing in kzalloc() NULL should be returned. Signed-off-by: Nicholas Mc Guire --- Problem was located with an experimental coccinelle script Patch was compile tested with: x86_64_defconfig + FTRACE=y FUNCTION_TRACER=y, EXPERT=y, LATENCYTOP

[PATCH 1/2] livepatch: handle kzalloc failure

2018-12-13 Thread Nicholas Mc Guire
kzalloc() return should always be checked - notably in example code where this may be seen as reference. On failure of allocation livepatch_fix1_dummy_alloc() should return NULL. Signed-off-by: Nicholas Mc Guire --- Problem was located with an experimental coccinelle script Patch was compile

[PATCH V2] pinctrl: rza1: handle devm_kasprintf() failure cases

2018-12-07 Thread Nicholas Mc Guire
. Signed-off-by: Nicholas Mc Guire Fixes: 5a49b644b307 ("pinctrl: Renesas RZ/A1 pin and gpio controller") Reviewed-by: Geert Uytterhoeven --- Problem was located with an experimental coccinelle script V2: drop the dev_err() messages as requested by Geert Uytterhoeven - thanks ! Patch w

[PATCH V2] pinctrl: rza1: handle devm_kasprintf() failure cases

2018-12-07 Thread Nicholas Mc Guire
. Signed-off-by: Nicholas Mc Guire Fixes: 5a49b644b307 ("pinctrl: Renesas RZ/A1 pin and gpio controller") Reviewed-by: Geert Uytterhoeven --- Problem was located with an experimental coccinelle script V2: drop the dev_err() messages as requested by Geert Uytterhoeven - thanks ! Patch w

[PATCH] soc: fsl: guts: us devm_kstrdup_const() for RO data

2018-12-07 Thread Nicholas Mc Guire
devm_kstrdup() may return NULL if internal allocation failed, but as machine is from the device tree, and thus RO, devm_kstrdup_const() can be used here, which will only copy the reference. Signed-off-by: Nicholas Mc Guire Fixes: a6fc3b698130 ("soc: fsl: add GUTS driver for QorIQ plat

Re: [PATCH] i2c: mux: demux-pinctrl: handle failure case of devm_kstrdup()

2018-12-04 Thread Nicholas Mc Guire
On Tue, Dec 04, 2018 at 02:11:33PM +, Peter Rosin wrote: > Ho hmm. Had another look at this patch, or rather, the context of the > patch so not really related, but... > > On 2018-12-01 11:01, Nicholas Mc Guire wrote: > > devm_kstrdup() may return NULL if internal allocatio

  1   2   3   4   5   6   7   8   9   10   >