]> git.kernelconcepts.de Git - karo-tx-linux.git/log
karo-tx-linux.git
7 years agostaging: ks7010: create reg_status_type enum type
Tobin C. Harding [Tue, 18 Apr 2017 00:35:29 +0000 (10:35 +1000)]
staging: ks7010: create reg_status_type enum type

SDIO header currently defines unused constants READ_STATUS_BUSY and
WRITE_STATUS_IDLE. There are reciprocal constants that are used
READ_STATUS_IDLE and WRITE_STATUS_BUSY. We can roll these into a
single enumeration type and remove the two that are unused.

Add enumeration type containing IDLE/BUSY pair that are currently used
within the SDIO source. Change source to use new enum types.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: greybus: uart.c: Remove include linux/serial.h
Darryl T. Agostinelli [Thu, 13 Apr 2017 01:36:15 +0000 (20:36 -0500)]
staging: greybus: uart.c: Remove include linux/serial.h

$ make includecheck | grep staging
./drivers/staging/greybus/uart.c: linux/serial.h is included more than once.

Signed-off-by: Darryl T. Agostinelli <dagostinelli@gmail.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: greybus: light.c: Remove include linux/version.h
Darryl T. Agostinelli [Thu, 13 Apr 2017 01:36:14 +0000 (20:36 -0500)]
staging: greybus: light.c: Remove include linux/version.h

Fixes:
$ make versioncheck | grep staging
./drivers/staging/greybus/light.c: 15 linux/version.h not needed.

Signed-off-by: Darryl T. Agostinelli <dagostinelli@gmail.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: Fix sparse endianness warnings cast to restricted __le64 and __le32
Skanda Guruanand [Sun, 16 Apr 2017 00:48:59 +0000 (17:48 -0700)]
staging: lustre: Fix sparse endianness warnings cast to restricted __le64 and __le32

The struct lu_dirpage elements in lustre_idl.h file are modified to
__le64 and __le32 types since the  elements are always converted from
litte endian to processor native format in mdc_request.c file.

Following warnings are removed by this fix.

drivers/staging/lustre/lustre/mdc/mdc_request.c:958:42: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:959:42: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:962:42: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:963:42: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:985:50: warning: cast to restricted __le32
drivers/staging/lustre/lustre/mdc/mdc_request.c:1193:24: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:1328:25: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:1329:23: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:1332:25: warning: cast to restricted __le64
drivers/staging/lustre/lustre/mdc/mdc_request.c:1333:23: warning: cast to restricted __le64

Signed-off-by: Skanda Guruanand <skanda.kashyap@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: lustre cleanup macros in libcfs_private.h
Craig Inches [Thu, 13 Apr 2017 09:24:41 +0000 (10:24 +0100)]
Staging: lustre cleanup macros in libcfs_private.h

This resolves a checkpatch warning that "Single statement macros should
not use a do {} while (0) loop" by removing the loop and adjusting line
length accordingly.

Signed-off-by: Craig Inches <Craig@craiginches.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: greybus: make cport_quiesce() method optional
Alexandre Bailon [Sun, 26 Mar 2017 16:58:23 +0000 (18:58 +0200)]
staging: greybus: make cport_quiesce() method optional

The cport_quiesce() method is mandatory in the case of
the es2 Greybus hd controller to shutdown the cports on
the es2 controller.
In order to add support of another controller which may not
need to shutdown its cports, make the cport_quiesce() optional,
and check if the controller implement it before to use it.

Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging/media: make atomisp vlv2_plat_clock explicitly non-modular
Paul Gortmaker [Thu, 13 Apr 2017 01:57:55 +0000 (21:57 -0400)]
staging/media: make atomisp vlv2_plat_clock explicitly non-modular

The Makefile / Kconfig currently controlling compilation of this code is:

clock/Makefile:obj-$(CONFIG_INTEL_ATOMISP)     += vlv2_plat_clock.o

atomisp/Kconfig:menuconfig INTEL_ATOMISP
atomisp/Kconfig:        bool "Enable support to Intel MIPI camera drivers"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was already not in use by this driver, the init
ordering remains unchanged with this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Alan Cox <alan@linux.intel.com>
Cc: linux-media@vger.kernel.org
Cc: devel@driverdev.osuosl.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: atomisp: remove odd 'list' file
Greg Kroah-Hartman [Tue, 18 Apr 2017 11:20:22 +0000 (13:20 +0200)]
staging: atomisp: remove odd 'list' file

This removes a strange 'list' file in
drivers/staging/media/atomisp/pci/atomisp2/ that was not being used for
anything.

Cc: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: atomisp: fix build breakage from files going away
Greg Kroah-Hartman [Tue, 18 Apr 2017 11:19:16 +0000 (13:19 +0200)]
staging: atomisp: fix build breakage from files going away

Previous patches deleted files, but the Makefile still referenced their
.o files.  Fix this up by removing them in the Makefile.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: remove unused spin_lock
Tobin C. Harding [Tue, 11 Apr 2017 23:56:50 +0000 (09:56 +1000)]
staging: ks7010: remove unused spin_lock

Driver SDIO private data structure description includes a spin_lock
that is never used. This data structure only contains a pointer to the
sdio_func and a pointer to the main device private data. A spin_lock
is not required here.

Remove unused spin_lock.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: remove unused structure description
Tobin C. Harding [Tue, 11 Apr 2017 23:56:49 +0000 (09:56 +1000)]
staging: ks7010: remove unused structure description

Driver SDIO header describes a structure that is never used. It can be
safely removed.

Remove unused structure description.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: remove unused read_buf
Tobin C. Harding [Tue, 11 Apr 2017 23:56:48 +0000 (09:56 +1000)]
staging: ks7010: remove unused read_buf

Driver SDIO code allocates memory for a buffer that is never used. It
can be safely removed.

Remove unused buffer, including allocation and freeing of memory.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: remove unused completion
Tobin C. Harding [Tue, 11 Apr 2017 23:56:47 +0000 (09:56 +1000)]
staging: ks7010: remove unused completion

Driver SDIO code initializes a completion that is never used. It can
be safely removed.

Remove unused completion.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: ensure cmd is large enough for %4s scanf format
Colin Ian King [Tue, 11 Apr 2017 21:21:47 +0000 (22:21 +0100)]
staging: rtl8723bs: ensure cmd is large enough for %4s scanf format

char array cmd is being scanned in using a %4s scanf format
specifier and so cmd must be an array of 5 chars. Increase size
to 5 chars to ensure we don't have an overflow.

Detected with static analysis by cppcheck:

"(error) Width 4 given in format string (no. 1) is larger than
destination buffer 'cmd[4]', use %3s to prevent overflowing it."

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: checking for NULL instead if IS_ERR
Dan Carpenter [Wed, 12 Apr 2017 08:31:53 +0000 (11:31 +0300)]
staging: lustre: checking for NULL instead if IS_ERR

lustre_cfg_new() returns error pointers and never NULL.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: media: atomisp: i2c: removed unnecessary white space before comma in memset()
Valerio Genovese [Sun, 2 Apr 2017 19:43:46 +0000 (21:43 +0200)]
staging: media: atomisp: i2c: removed unnecessary white space before comma in memset()

Removed extra space before comma in memset() as a part of
checkpatch.pl fix-up.

Signed-off-by: Valerio Genovese <valerio.click@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: atomisp: avoid false-positive maybe-uninitialized warning
Arnd Bergmann [Wed, 29 Mar 2017 21:12:21 +0000 (23:12 +0200)]
staging: atomisp: avoid false-positive maybe-uninitialized warning

In combination with CONFIG_PROFILE_ANNOTATED_BRANCHES=y, the unlikely()
inside of the WARN() macro becomes too complex for gcc to see that
we don't use the output arguments of mt9m114_to_res() are used
correctly:

drivers/staging/media/atomisp/i2c/mt9m114.c: In function 'mt9m114_get_fmt':
drivers/staging/media/atomisp/i2c/mt9m114.c:817:13: error: 'height' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  int width, height;
             ^~~~~~
drivers/staging/media/atomisp/i2c/mt9m114.c: In function 'mt9m114_s_exposure_selection':
drivers/staging/media/atomisp/i2c/mt9m114.c:1179:13: error: 'height' may be used uninitialized in this function [-Werror=maybe-uninitialized]

Without WARN_ON(), there is no problem, so by simply replacing it with
v4l2_err(), the warnings go away. The WARN() output is also not needed
here, as we'd probably catch the problem before even getting here,
and other checks for the same condition already use v4l2_err.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoatomisp: remove UDS kernel code
Alan Cox [Wed, 12 Apr 2017 18:22:46 +0000 (19:22 +0100)]
atomisp: remove UDS kernel code

UDS is another layer which actually boils down to some trivial assignments so
remove it so inline the code.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoatomisp: remove xnr3_0_5 and xnr3_0_11
Alan Cox [Wed, 12 Apr 2017 18:22:35 +0000 (19:22 +0100)]
atomisp: remove xnr3_0_5 and xnr3_0_11

These are not used in the driver so can go away.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoatomisp: remove fixedbds kernel code
Alan Cox [Wed, 12 Apr 2017 18:22:25 +0000 (19:22 +0100)]
atomisp: remove fixedbds kernel code

This is a whole pile of code that wraps a single assignment. Remove it and
put the assignment in the caller. Once we have the kernels sorted we should
revisit these and remove all the pointless 1 item structs that go with it.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoatomisp: remove satm kernel
Alan Cox [Wed, 12 Apr 2017 18:22:13 +0000 (19:22 +0100)]
atomisp: remove satm kernel

This isn't used so it can go in the bitbucket.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoatomisp: remove contiguous handling
Alan Cox [Wed, 12 Apr 2017 18:21:59 +0000 (19:21 +0100)]
atomisp: remove contiguous handling

The base hmm MMU code doesn't support contiguous allocations (they BUG), so
remove support from them from the higher levels of the heirarchy.

We still need to unwind all these layers but it turns out that some of the init
order stuff is rather sensitive and the simple cleanup breaks everything

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoatomisp: remove sh_css_malloc indirections where we can
Alan Cox [Wed, 12 Apr 2017 18:21:44 +0000 (19:21 +0100)]
atomisp: remove sh_css_malloc indirections where we can

Where we know the buffer size is reasonably constrained we can just use kmalloc,
and where it will be large vmalloc. This still leaves a pile in the middle.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoatomisp: remove indirection from sh_css_malloc
Alan Cox [Wed, 12 Apr 2017 18:21:33 +0000 (19:21 +0100)]
atomisp: remove indirection from sh_css_malloc

We have one hard coded set of behaviour so unpick the indirection and function
pointers. This isn't the whole story. A lot of the callers are known sizes and
use cases so we can switch them directly to kmalloc later on.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoatomisp: unwrap the _ex malloc/free functions
Alan Cox [Wed, 12 Apr 2017 18:21:22 +0000 (19:21 +0100)]
atomisp: unwrap the _ex malloc/free functions

We are not using these for debugging or debug logging so remove the defines,
trim and rename the functions.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoatomisp: remove most of the uses of atomisp_kernel_malloc
Alan Cox [Wed, 12 Apr 2017 18:21:05 +0000 (19:21 +0100)]
atomisp: remove most of the uses of atomisp_kernel_malloc

They can be replaced by kmalloc. There are a few that do need to pick kmalloc
or vmalloc. Those we leave for the moment.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: atomisp: move mipi_info assignment to next line in __get_asd_from_port()
Daeseok Youn [Wed, 12 Apr 2017 18:20:49 +0000 (19:20 +0100)]
staging: atomisp: move mipi_info assignment to next line in __get_asd_from_port()

The line which is initializing mipi_info variable is too long
to read. It would be placed in next line.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: atomisp: replace "&isp->asd[i]" with "asd" in __get_asd_from_port()
Daeseok Youn [Wed, 12 Apr 2017 18:20:36 +0000 (19:20 +0100)]
staging: atomisp: replace "&isp->asd[i]" with "asd" in __get_asd_from_port()

The address of isp->asd[i] is already assigned to
local "asd" variable. "&isp->asd[i]" would be replaced with
just "asd".

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: atomisp: remove enable_isp_irq function and add disable_isp_irq
Daeseok Youn [Wed, 12 Apr 2017 18:20:22 +0000 (19:20 +0100)]
staging: atomisp: remove enable_isp_irq function and add disable_isp_irq

Enable/Disable ISP irq is switched with "enable" parameter of
enable_isp_irq(). It would be better splited to two such as
enable_isp_irq()/disable_isp_irq().

But the enable_isp_irq() is no use in atomisp_cmd.c file.
So remove the enable_isp_irq() function and add
disable_isp_irq function only.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging/atomisp: fix spelling mistake: "falied" -> "failed"
Colin Ian King [Wed, 12 Apr 2017 18:20:10 +0000 (19:20 +0100)]
staging/atomisp: fix spelling mistake: "falied" -> "failed"

trivial fix to spelling mistake in dev_err error message

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: atomisp: use local variable to reduce number of references
Daeseok Youn [Wed, 12 Apr 2017 18:20:01 +0000 (19:20 +0100)]
staging: atomisp: use local variable to reduce number of references

Define new local variable to reduce the number of reference.
The new local variable is added to save the addess of dfs
and used in atomisp_freq_scaling() function.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: move check and break to top of loop
Tobin C. Harding [Mon, 10 Apr 2017 03:16:01 +0000 (13:16 +1000)]
staging: ks7010: move check and break to top of loop

Function uses an if statement within a for loop to guard a block of
code. If 'if' statement conditional evaluates to false, loop breaks. The
same logic can be expressed by inverting the conditional and breaking
when new conditional evaluates to true. This allows the subsequent code
to be indented one level less, aiding readability. Reduced indentation
also allows for the code to be laid out more clearly and fixes two
checkpatch warnings.

Invert if statement conditional, break from for loop if new
conditional evaluates to true. Reduce indentation in subsequent code,
fix whitespace issues. Do not change program logic.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: remove multi-way decision
Tobin C. Harding [Mon, 10 Apr 2017 03:16:00 +0000 (13:16 +1000)]
staging: ks7010: remove multi-way decision

Function uses multi-way decision for control flow. Final statement of
function is spin_unlock(). Code can be simplified by adding a goto label
labelling the call to spin_unlock() and jumping to label instead of
using multi-way decision. This allows the code to be indented one
level less which adds to the readability.

Add goto label. Remove multi-way decision by jumping to label. Reduce
indentation in subsequent code. Do not change program logic.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: remove unused macro
Tobin C. Harding [Mon, 10 Apr 2017 03:15:59 +0000 (13:15 +1000)]
staging: ks7010: remove unused macro

Macro CHECK_ALINE is defined and never used.

Remove unused macro.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: fix checkpatch MULTILINE_DEREFERENCE
Tobin C. Harding [Mon, 10 Apr 2017 03:15:58 +0000 (13:15 +1000)]
staging: ks7010: fix checkpatch MULTILINE_DEREFERENCE

Checkpatch emits WARNING: Avoid multiple line dereference.

Fix up layout of function call, move dereference to single line.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: fix checkpatch LOGICAL_CONTINUATIONS
Tobin C. Harding [Mon, 10 Apr 2017 03:15:57 +0000 (13:15 +1000)]
staging: ks7010: fix checkpatch LOGICAL_CONTINUATIONS

Checkpatch emits multiple CHECK: Logical continuations should be on the
previous line.

Move logical continuations to the end of the previous line.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: rename identifier packet to skb
Tobin C. Harding [Mon, 10 Apr 2017 03:15:56 +0000 (13:15 +1000)]
staging: ks7010: rename identifier packet to skb

Kernel networking code predominately uses the identifier 'skb' for a struct
sk_buff pointer. Of 8088 instances of 'struct sk_buff *' within
net/ 6670 are named 'skb'. Following the principle of least surprise,
new networking code should use the identifier 'skb' for variables of
type 'struct sk_buff *'.

Rename identifier 'packet' to 'skb'.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: add task to TODO file
Tobin C. Harding [Mon, 10 Apr 2017 03:15:55 +0000 (13:15 +1000)]
staging: ks7010: add task to TODO file

Driver uses custom Michael MIC implementation. There is already an
implementation within the kernel. There is at least one other driver
already using the kernel implementation
(drivers/net/wireless/intersil/orinoco).

Add task to TODO file.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: rename RecvMIC to recv_mic
Tobin C. Harding [Mon, 10 Apr 2017 03:15:54 +0000 (13:15 +1000)]
staging: ks7010: rename RecvMIC to recv_mic

Identifier uses camel case, standard kernel style does not use camel
case.

Rename buffer 'RecvMIC' to 'recv_mic'.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: fix checkpatch UNNECESSARY_ELSE
Tobin C. Harding [Mon, 10 Apr 2017 03:15:53 +0000 (13:15 +1000)]
staging: ks7010: fix checkpatch UNNECESSARY_ELSE

Checkpatch emits WARNING: else is not generally useful after a break
or return. Two warnings of this type are emitted for this code block,
in both cases 'else' statements are unnecessary.

Remove unnecessary 'else' statements, reduce indentation in subsequent
code.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: fix checkpatch PARENTHESIS_ALIGNMENT
Tobin C. Harding [Mon, 10 Apr 2017 03:15:52 +0000 (13:15 +1000)]
staging: ks7010: fix checkpatch PARENTHESIS_ALIGNMENT

Checkpatch emits CHECK: Alignment should match open parenthesis.

Align argument to open parenthesis.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: utilize local variable
Tobin C. Harding [Mon, 10 Apr 2017 03:15:51 +0000 (13:15 +1000)]
staging: ks7010: utilize local variable

Function contains a local pointer variable defined to a memory location
within a structure. This memory location is later used by
dereferencing the struct instead of using the local pointer. The code
is cleaner if all references of the same memory location use the
local variable.

Utilize existing local pointer variable instead of dereferencing
struct.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: simplify calls to memcpy()
Tobin C. Harding [Mon, 10 Apr 2017 03:15:50 +0000 (13:15 +1000)]
staging: ks7010: simplify calls to memcpy()

Function uses overly complex calls to memcpy(). Code may be simplified
by the use of a local variable. Code sometimes uses explicit address
of initial array element and sometimes does not. Uniformity aids
readability. If array pointers are explicit it aids readability further.

Simplify calls to memcpy(). Add local pointer variable, define it to
the correct memory location. Use newly defined variable in calls to
memcpy(). Be uniform in use of explicit address of first element of
array (&foo[0]).

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: move null check before dereference
Tobin C. Harding [Mon, 10 Apr 2017 03:15:49 +0000 (13:15 +1000)]
staging: ks7010: move null check before dereference

Function parameter is cast to a local pointer which is then
dereferenced before it is checked to be non-NULL.

Move pointer null check to be before the pointer is dereferenced.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: fix multi-way decision
Tobin C. Harding [Mon, 10 Apr 2017 03:15:48 +0000 (13:15 +1000)]
staging: ks7010: fix multi-way decision

Multi-way decision contains two anomalies.

Firstly, a local variable is defined to be the inverse truth variable
of a struct member. This local variable is used as the conditional to
the multi-way decision. This is unnecessary, the same logic can be
expressed using the struct member directly.

Secondly, there are four branches in the multi-way decision, two of
which can never be executed. This is dead code.

Remove unnecessary local variable. Remove two branches of multi-way
decision statement that can never be executed.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: factor out send stop request
Tobin C. Harding [Mon, 10 Apr 2017 03:15:47 +0000 (13:15 +1000)]
staging: ks7010: factor out send stop request

Function contains compound statement delineated by lone braces. This
statement represents a discreet set of functionality and thus can be
factored out into a separate function. Using a separate function
instead of a compound statement increases readability, reduces code
indentation, reduces function length, and generally looks more tidy.

Factor compound statement out to separate function.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: fix function return code path
Tobin C. Harding [Mon, 10 Apr 2017 03:15:46 +0000 (13:15 +1000)]
staging: ks7010: fix function return code path

Function has duplicate code clean up sequences; identical function
call followed by return. This would be better expressed with the use
of a goto statement, as is typical in-tree.

One call site places the clean up code within the 'else' branch of an
multi-way decision. This can be more clearly expressed by inverting
the initial decision conditional and jumping directly to the cleanup
code. Subsequent code indentation can then be reduced, aiding
readability.

Fix function return code execution path. Move clean up code to end of
function with a label. Replace duplicate clean up code within function
with a jump to label. Invert conditional, jump to label if new
conditional evaluates to true, reduce indentation in subsequent code.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: separate dissimilar checks
Tobin C. Harding [Mon, 10 Apr 2017 03:15:45 +0000 (13:15 +1000)]
staging: ks7010: separate dissimilar checks

Function contains a list of four checks, for no apparent reason two of them
are OR'ed together. Having two OR'ed together and the other two not
implies some connection between the two that are combined. It is
easier to read this code if the four unrelated checks are done as
separate statements.

Move dissimilar expressions out of logical continuation and into
separate statement.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: change static function return type
Tobin C. Harding [Mon, 10 Apr 2017 03:15:44 +0000 (13:15 +1000)]
staging: ks7010: change static function return type

Function has return type 'int'. Function has internal linkage. Function
returns 0 on all execution paths. Function is called only once in the
driver and the return value is not checked. Removal of this return
value does not change the program logic. The 'int' return type is not
adding any information thus it is better to remove it.

Change return type of function with internal linkage from 'int' to
'void'.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: invert conditional, reduce indentation
Tobin C. Harding [Mon, 10 Apr 2017 03:15:43 +0000 (13:15 +1000)]
staging: ks7010: invert conditional, reduce indentation

A number of functions have blocks of code guarded by an if statement.

if (foo) {
        /* block of code */
}

This can, on occasion, more succinctly be expressed as

if (!foo)
return

/* block of code */

This change will mean a number of whitespace issues need to be
addressed/fixed. The diff can be a little hard to read when there are
multiple lines that are very similar (for example error return
code). Splitting the indentation reduction and the whitespace fixes
into two separate patches was not found to aid reading the
diff. Therefor we fix the whitespace issues at the same time. We need
to be very sure to not make any changes to the program logic, this is
ensured by only doing what is stated - invert the conditional, fix
whitespace.

Invert if statement conditionals. Return if new conditional evaluates
to true. Reduce level of indentation in subsequent code. Fix white
space issues.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: rename identifier retval to ret
Tobin C. Harding [Mon, 10 Apr 2017 03:15:42 +0000 (13:15 +1000)]
staging: ks7010: rename identifier retval to ret

Function uses identifier 'retval' to hold the error return value. The
rest of the driver uses 'ret' for this purpose. Being uniform in the
choice of identifiers generally adds to the cleanliness of the code,
also it is arguably easier to follow the code if one name is used for
one task.

Rename identifier 'retval' to 'ret'.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: rename identifier rc to ret
Tobin C. Harding [Mon, 10 Apr 2017 03:15:41 +0000 (13:15 +1000)]
staging: ks7010: rename identifier rc to ret

Driver uses identifier 'rc' to hold the value for error return
code. The rest of the driver predominately uses 'ret' for this
purpose. It is easier to follow the code if one name is used for one
task.

Rename identifier 'rc' to 'ret'.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: change length type to unsigned
Tobin C. Harding [Mon, 10 Apr 2017 03:15:40 +0000 (13:15 +1000)]
staging: ks7010: change length type to unsigned

Length undergoes type conversion when passed (indirectly) as an
argument for parameter of type 'unsigned int'. If length is negative
this is a bug (the value after conversion is large).

Declare 'length' to be an unsigned type instead of a signed type.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: remove void * cast
Tobin C. Harding [Mon, 10 Apr 2017 03:15:39 +0000 (13:15 +1000)]
staging: ks7010: remove void * cast

Functions accept a parameter of type 'void *', this is then cast to a
struct ks_wlan_private pointer. All call sites have a struct
ks_wlan_private pointer and cast it to 'void *'. We can remove the
unnecessary casting by changing the parameter type to match the
usage. Functions changed all have internal linkage.

Replace parameter of type 'void *' with 'struct ks_wlan_private
*'. Remove unnecessary casting to and from 'void *'.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: ks7010: remove unnecessary function parameter
Tobin C. Harding [Mon, 10 Apr 2017 03:15:38 +0000 (13:15 +1000)]
staging: ks7010: remove unnecessary function parameter

Function ks7010_upload_firmware() takes as parameters, two struct
pointers, one of which is a member of the other. This is unnecessary
since one can be accessed via the other.

Remove function parameter and fix all call sites.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: fix spelling mistake: "acquire"
Colin Ian King [Tue, 11 Apr 2017 13:17:08 +0000 (14:17 +0100)]
staging: rtl8723bs: fix spelling mistake: "acquire"

trivial fix to spelling mistake in pr_info message

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: fix spelling mistakes in RT_TRACE messages
Colin Ian King [Tue, 11 Apr 2017 13:31:20 +0000 (14:31 +0100)]
staging: rtl8723bs: fix spelling mistakes in RT_TRACE messages

Fix a few spelling mistakes in RT_TRACE messages and split up
wide lines to span multiple lines

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8188eu: force driver to be built as a module
Hans de Goede [Tue, 11 Apr 2017 09:19:53 +0000 (11:19 +0200)]
staging: rtl8188eu: force driver to be built as a module

The rtl8188eu driver defines a ton of global symbols which tend to
conflict with other realtek wifi drivers, force it to be built as
a module.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: force driver to be built as a module.
Greg Kroah-Hartman [Tue, 11 Apr 2017 05:35:53 +0000 (07:35 +0200)]
staging: rtl8723bs: force driver to be built as a module.

Due to the ton of global symbols, the driver has to be a module
otherwise the build blows up if it is compiled into the kernel.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: remove null test before kfree
Aishwarya Pant [Mon, 10 Apr 2017 13:43:50 +0000 (19:13 +0530)]
staging: rtl8723bs: remove null test before kfree

kfree(..) on a NULL pointer is a no-op; the null test here is redundant.
Detected by coccicheck.

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Add missing include <linux/of.h> to fix compile error
Hans de Goede [Mon, 10 Apr 2017 19:13:07 +0000 (21:13 +0200)]
staging: rtl8723bs: Add missing include <linux/of.h> to fix compile error

As reported by Stephen Rothwell when merging staging-next,
drivers/staging/rtl8723bs/core/rtw_ieee80211.c does not compile due
to of_get_property not being declared.

Explicitly include <linux/of.h> to fix this compile error.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoMerge 4.11-rc6 into staging-next
Greg Kroah-Hartman [Mon, 10 Apr 2017 13:21:55 +0000 (15:21 +0200)]
Merge 4.11-rc6 into staging-next

We want the staging and iio fixes in here to handle merging easier.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoLinux 4.11-rc6 v4.11-rc6
Linus Torvalds [Sun, 9 Apr 2017 16:49:44 +0000 (09:49 -0700)]
Linux 4.11-rc6

7 years agoMerge branch 'for-next' of git://git.samba.org/sfrench/cifs-2.6
Linus Torvalds [Sun, 9 Apr 2017 16:10:02 +0000 (09:10 -0700)]
Merge branch 'for-next' of git://git.samba.org/sfrench/cifs-2.6

Pull CIFS fixes from Steve French:
 "This is a set of CIFS/SMB3 fixes for stable.

  There is another set of four SMB3 reconnect fixes for stable in
  progress but they are still being reviewed/tested, so didn't want to
  wait any longer to send these five below"

* 'for-next' of git://git.samba.org/sfrench/cifs-2.6:
  Reset TreeId to zero on SMB2 TREE_CONNECT
  CIFS: Fix build failure with smb2
  Introduce cifs_copy_file_range()
  SMB3: Rename clone_range to copychunk_range
  Handle mismatched open calls

7 years agoMerge branch 'fixes' of git://git.armlinux.org.uk/~rmk/linux-arm
Linus Torvalds [Sun, 9 Apr 2017 16:05:25 +0000 (09:05 -0700)]
Merge branch 'fixes' of git://git.armlinux.org.uk/~rmk/linux-arm

Pull ARM fixes from Russell King:
 "A number of ARM fixes:

   - prevent oopses caused by dma_get_sgtable() and declared DMA
     coherent memory

   - fix boot failure on nommu caused by ID_PFR1 access

   - a number of kprobes fixes from Jon Medhurst and Masami Hiramatsu"

* 'fixes' of git://git.armlinux.org.uk/~rmk/linux-arm:
  ARM: 8665/1: nommu: access ID_PFR1 only if CPUID scheme
  ARM: dma-mapping: disallow dma_get_sgtable() for non-kernel managed memory
  arm: kprobes: Align stack to 8-bytes in test code
  arm: kprobes: Fix the return address of multiple kretprobes
  arm: kprobes: Skip single-stepping in recursing path if possible
  arm: kprobes: Allow to handle reentered kprobe on single-stepping

7 years agoMerge tag 'driver-core-4.11-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sun, 9 Apr 2017 16:03:51 +0000 (09:03 -0700)]
Merge tag 'driver-core-4.11-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core fixes from Greg KH:
 "Here are 3 small fixes for 4.11-rc6.

  One resolves a reported issue with sysfs files that NeilBrown found,
  one is a documenatation fix for the stable kernel rules, and the last
  is a small MAINTAINERS file update for kernfs"

* tag 'driver-core-4.11-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
  MAINTAINERS: separate out kernfs maintainership
  sysfs: be careful of error returns from ops->show()
  Documentation: stable-kernel-rules: fix stable-tag format

7 years agoMerge tag 'staging-4.11-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
Linus Torvalds [Sun, 9 Apr 2017 16:02:31 +0000 (09:02 -0700)]
Merge tag 'staging-4.11-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging/IIO driver rfixes from Greg KH:
 "Here are a number of small IIO and staging driver fixes for 4.11-rc6.
  Nothing big here, just iio fixes for reported issues, and an ashmem
  fix for a very old bug that has been reported by a number of Android
  vendors"

* tag 'staging-4.11-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
  staging: android: ashmem: lseek failed due to no FMODE_LSEEK.
  iio: hid-sensor-attributes: Fix sensor property setting failure.
  iio: accel: hid-sensor-accel-3d: Fix duplicate scan index error
  iio: core: Fix IIO_VAL_FRACTIONAL_LOG2 for negative values
  iio: st_pressure: initialize lps22hb bootime
  iio: bmg160: reset chip when probing
  iio: cros_ec_sensors: Fix return value to get raw and calibbias data.

7 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Linus Torvalds [Sun, 9 Apr 2017 15:26:21 +0000 (08:26 -0700)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull VFS fixes from Al Viro:
 "statx followup fixes and a fix for stack-smashing on alpha"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  alpha: fix stack smashing in old_adjtimex(2)
  statx: Include a mask for stx_attributes in struct statx
  statx: Reserve the top bit of the mask for future struct expansion
  xfs: report crtime and attribute flags to statx
  ext4: Add statx support
  statx: optimize copy of struct statx to userspace
  statx: remove incorrect part of vfs_statx() comment
  statx: reject unknown flags when using NULL path
  Documentation/filesystems: fix documentation for ->getattr()

7 years agostaging: rtl8723bs: core: rtw_cmd: drop unneeded null tests
Julia Lawall [Sat, 8 Apr 2017 17:12:27 +0000 (19:12 +0200)]
staging: rtl8723bs: core: rtw_cmd: drop unneeded null tests

kfree returns immediately on NULL so the tests are not needed.

Generated by: scripts/coccinelle/free/ifnullfree.cocci

CC: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: core: rtw_cmd: drop unneeded null test
Julia Lawall [Sat, 8 Apr 2017 17:14:08 +0000 (19:14 +0200)]
staging: rtl8723bs: core: rtw_cmd: drop unneeded null test

kfree returns immediately on NULL so the tests are not needed.

Generated by: scripts/coccinelle/free/ifnullfree.cocci

CC: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix indenting error in core/rtw_pwrctrl.c
Larry Finger [Sat, 8 Apr 2017 16:07:45 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix indenting error in core/rtw_pwrctrl.c

Smatch reports the following:

  CHECK   drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
drivers/staging/rtl8723bs/core/rtw_pwrctrl.c:641 LeaveAllPowerSaveModeDirect() warn: inconsistent indenting

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix indenting problems in core/rtw_odm.c
Larry Finger [Sat, 8 Apr 2017 16:07:44 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix indenting problems in core/rtw_odm.c

Smatch reports the following:

  CHECK   drivers/staging/rtl8723bs/core/rtw_odm.c
drivers/staging/rtl8723bs/core/rtw_odm.c:109 rtw_odm_dbg_comp_msg() warn: if statement not indented
drivers/staging/rtl8723bs/core/rtw_odm.c:146 rtw_odm_ability_msg() warn: if statement not indented

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix indenting errors and an off-by-one mistake in core/rtw_mlme_ext.c
Larry Finger [Sat, 8 Apr 2017 16:07:43 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix indenting errors and an off-by-one mistake in core/rtw_mlme_ext.c

Smatch lists the following:

  CHECK   drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:525 _mgt_dispatcher() warn: inconsistent indenting
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:1595 OnAssocReq() error: buffer overflow 'pstapriv->sta_aid' 32 <= 32
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:2391 dump_mgntframe_and_wait() warn: inconsistent indenting
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:2420 dump_mgntframe_and_wait_ack() warn: inconsistent indenting
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:4969 process_80211d() error: testing array offset 'i' after use.
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:5738 linked_status_chk() warn: inconsistent indenting
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:6459 sitesurvey_cmd_hdl() warn: inconsistent indenting

The indenting problems were fixed with white-space changes. The error at
line 1595 was the result of an off-by-one error in a for loop. The error
at line 4969 was not fixed as that code lies inside a block of code that
only is needed for 5G channels. This chip only works at 2.4 GHz.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix white-space errors in core/rtw_recv.c
Larry Finger [Sat, 8 Apr 2017 16:07:42 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix white-space errors in core/rtw_recv.c

Smart reports the following:

  CHECK   drivers/staging/rtl8723bs/core/rtw_recv.c
drivers/staging/rtl8723bs/core/rtw_recv.c:598 portctrl() warn: inconsistent indenting
drivers/staging/rtl8723bs/core/rtw_recv.c:838 sta2sta_data_frame() warn: inconsistent indenting
drivers/staging/rtl8723bs/core/rtw_recv.c:1547 validate_recv_frame() warn: inconsistent indenting

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix some white-space errors in core/rtw_security.c
Larry Finger [Sat, 8 Apr 2017 16:07:41 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix some white-space errors in core/rtw_security.c

Smatch reports the following:

  CHECK   drivers/staging/rtl8723bs/core/rtw_security.c
drivers/staging/rtl8723bs/core/rtw_security.c:266 rtw_wep_encrypt() warn: inconsistent indenting
drivers/staging/rtl8723bs/core/rtw_security.c:433 rtw_seccalctkipmic() warn: inconsistent indenting
drivers/staging/rtl8723bs/core/rtw_security.c:749 rtw_tkip_encrypt() warn: inconsistent indenting
drivers/staging/rtl8723bs/core/rtw_security.c:865 rtw_tkip_decrypt() warn: inconsistent indenting
drivers/staging/rtl8723bs/core/rtw_security.c:1383 aes_cipher() warn: inconsistent indenting
drivers/staging/rtl8723bs/core/rtw_security.c:1415 aes_cipher() warn: inconsistent indenting
drivers/staging/rtl8723bs/core/rtw_security.c:1430 aes_cipher() warn: inconsistent indenting
drivers/staging/rtl8723bs/core/rtw_security.c:1582 rtw_aes_encrypt() warn: inconsistent indenting
drivers/staging/rtl8723bs/core/rtw_security.c:1651 aes_decipher() warn: inconsistent indenting
drivers/staging/rtl8723bs/core/rtw_security.c:1739 aes_decipher() warn: inconsistent indenting
drivers/staging/rtl8723bs/core/rtw_security.c:1792 aes_decipher() warn: curly braces intended?
drivers/staging/rtl8723bs/core/rtw_security.c:1809 aes_decipher() warn: inconsistent indenting

All of the above are fixed with white-space changes. A few unneeded
blank lines are deleted.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix indenting problem in core/rtw_sta_mgt.c
Larry Finger [Sat, 8 Apr 2017 16:07:40 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix indenting problem in core/rtw_sta_mgt.c

Sparse reports the following:

  CHECK   drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
drivers/staging/rtl8723bs/core/rtw_sta_mgt.c:25 _rtw_init_stainfo() warn: inconsistent indenting

This problem is fixed with a white-spcae change.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix some indenting problems and a potential data overrun
Larry Finger [Sat, 8 Apr 2017 16:07:39 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix some indenting problems and a potential data overrun

Smatch reports the following:

  CHECK   drivers/staging/rtl8723bs/core/rtw_wlan_util.c
drivers/staging/rtl8723bs/core/rtw_wlan_util.c:67 cckrates_included() warn: if statement not indented
drivers/staging/rtl8723bs/core/rtw_wlan_util.c:81 cckratesonly_included() warn: if statement not indented
drivers/staging/rtl8723bs/core/rtw_wlan_util.c:815 rtw_camid_alloc() warn: should '1 << (cam_id)' be a 64 bit type?

The first two are fixed with white-space changes. The third is fixed by
restricting cam_id to be less than 32.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix indenting mistakes in core/rtw_mlme.c
Larry Finger [Sat, 8 Apr 2017 16:07:38 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix indenting mistakes in core/rtw_mlme.c

Smatch reports the following:

  CHECK   drivers/staging/rtl8723bs/core/rtw_mlme.c
drivers/staging/rtl8723bs/core/rtw_mlme.c:862 rtw_survey_event_callback() warn: inconsistent indenting
drivers/staging/rtl8723bs/core/rtw_mlme.c:1102 rtw_free_assoc_resources() warn: if statement not indented
drivers/staging/rtl8723bs/core/rtw_mlme.c:1165 rtw_indicate_disconnect() warn: inconsistent indenting
drivers/staging/rtl8723bs/core/rtw_mlme.c:2830 rtw_restructure_ht_ie() warn: inconsistent indenting
drivers/staging/rtl8723bs/core/rtw_mlme.c:2991 rtw_update_ht_cap() warn: inconsistent indenting

All of there are simple white-space errors. A typo is also fixed.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix indenting mistakes in core/rtw_ieee80211.c
Larry Finger [Sat, 8 Apr 2017 16:07:37 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix indenting mistakes in core/rtw_ieee80211.c

Smatch reports the following:

  CHECK   drivers/staging/rtl8723bs/core/rtw_ieee80211.c
drivers/staging/rtl8723bs/core/rtw_ieee80211.c:83 rtw_is_cckrates_included() warn: if statement not indented
drivers/staging/rtl8723bs/core/rtw_ieee80211.c:98 rtw_is_cckratesonly_included() warn: if statement not indented

These warnings are fixed with white-space changes.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix indenting mistake in core/rtw_ap.c
Larry Finger [Sat, 8 Apr 2017 16:07:36 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix indenting mistake in core/rtw_ap.c

Smatch reports the following:

  CHECK   drivers/staging/rtl8723bs/core/rtw_ap.c
drivers/staging/rtl8723bs/core/rtw_ap.c:382 expire_timeout_chk() warn: inconsistent indenting

Fixing this requires changing the indentatikon of a long for loop.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix possible usage of NULL pointer in core/rtw_debug.c
Larry Finger [Sat, 8 Apr 2017 16:07:35 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix possible usage of NULL pointer in core/rtw_debug.c

Smatch reports the following:

  CHECK   drivers/staging/rtl8723bs/core/rtw_debug.c
drivers/staging/rtl8723bs/core/rtw_debug.c:454 proc_get_survey_info() error: we previously assumed 'phead' could be null (see line 453)
drivers/staging/rtl8723bs/core/rtw_debug.c:455 proc_get_survey_info() warn: variable dereferenced before check 'phead' (see line 454)

In the code, there are two successive calls to get_head(). The second
is removed.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix indenting problems in core/rtw_xmit.c
Larry Finger [Sat, 8 Apr 2017 16:07:34 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix indenting problems in core/rtw_xmit.c

Smatch logs the following:

  CHECK   drivers/staging/rtl8723bs/core/rtw_xmit.c
drivers/staging/rtl8723bs/core/rtw_xmit.c:277 _rtw_init_xmit_priv() warn: inconsistent indenting
drivers/staging/rtl8723bs/core/rtw_xmit.c:294 _rtw_free_xmit_priv() warn: inconsistent indenting
drivers/staging/rtl8723bs/core/rtw_xmit.c:295 _rtw_free_xmit_priv() warn: inconsistent indenting
drivers/staging/rtl8723bs/core/rtw_xmit.c:946 xmitframe_addmic() warn: inconsistent indenting

These are fixed with white-space changes.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix indenting problem for hal/hal_com.c
Larry Finger [Sat, 8 Apr 2017 16:07:33 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix indenting problem for hal/hal_com.c

Smatch lists the following:

  CHECK   drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
drivers/staging/rtl8723bs/hal/hal_com_phycfg.c:2090 Hal_ChannelPlanToRegulation() warn: inconsistent indenting

Fixed by changing the white space.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix indening problem in hal/hal_com_phycfg.c
Larry Finger [Sat, 8 Apr 2017 16:07:32 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix indening problem in hal/hal_com_phycfg.c

Smatch reports the following:

  CHECK   drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
drivers/staging/rtl8723bs/hal/hal_com_phycfg.c:2090 Hal_ChannelPlanToRegulation() warn: inconsistent indenting

This warning is fixed with a white-space change.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix indenting problems in hal/HalHWImg8723B_BB.c
Larry Finger [Sat, 8 Apr 2017 16:07:31 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix indenting problems in hal/HalHWImg8723B_BB.c

Smatch lists the following:

  CHECK   drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.c
drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.c:314 ODM_ReadAndConfig_MP_8723B_AGC_TAB() warn: for statement not indented
drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.c:583 ODM_ReadAndConfig_MP_8723B_PHY_REG() warn: for statement not indented
drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.c:586 ODM_ReadAndConfig_MP_8723B_PHY_REG() warn: inconsistent indenting

These were all fixed with white-space changes.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix potential usage while NULL error in hal/rtl8723b_hal_init.c
Larry Finger [Sat, 8 Apr 2017 16:07:30 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix potential usage while NULL error in hal/rtl8723b_hal_init.c

Smatch logs the following:

  CHECK   drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c:518 rtl8723b_FirmwareDownload() error: we previously assumed 'pFirmware' could be null (see line 382)

Fixing this error required a rewrite of the error exits from this routine.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix various errors in os_dep/ioctl_cfg80211.c
Larry Finger [Sat, 8 Apr 2017 16:07:29 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix various errors in os_dep/ioctl_cfg80211.c

Smatch lists the following:

  CHECK   drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:470 rtw_cfg80211_ibss_indicate_connect() error: we previously assumed 'scanned' could be null (see line 466)
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:942 rtw_cfg80211_set_encryption() warn: inconsistent indenting
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:955 rtw_cfg80211_set_encryption() error: buffer overflow 'psecuritypriv->dot11DefKey' 4 <= 4
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:1017 rtw_cfg80211_set_encryption() error: buffer overflow 'padapter->securitypriv.dot118021XGrpKey' 5 <= 5
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:1216 cfg80211_rtw_set_default_key() warn: inconsistent indenting
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:2498 rtw_cfg80211_monitor_if_xmit_entry() error: we previously assumed 'skb' could be null (see line 2495)
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:2850 cfg80211_rtw_start_ap() warn: if statement not indented
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:2860 cfg80211_rtw_start_ap() warn: if statement not indented
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:3417 rtw_cfg80211_preinit_wiphy() warn: inconsistent indenting
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:3547 rtw_wdev_alloc() info: ignoring unreachable code.

The indenting warnings were fixed by simple white space changes.

The section where 'scanned' could be null required an immediate exit from
the routine at that point. A similar fix was required where 'skb' could be null.

The two buffer overflow errors were caused by off-by-one errors. While
locating these problems, another one was found in os_dep/ioctl_linux.c.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix indenting mistake in os_dep/mlme_linux.c
Larry Finger [Sat, 8 Apr 2017 16:07:28 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix indenting mistake in os_dep/mlme_linux.c

Smatch reports the following warning:

  CHECK   drivers/staging/rtl8723bs/os_dep/mlme_linux.c
drivers/staging/rtl8723bs/os_dep/mlme_linux.c:149 rtw_os_indicate_disconnect() warn: inconsistent indenting

Again, a simple change in the white space fixes this problem.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix indenting warning in os_dep/os_intfs.c
Larry Finger [Sat, 8 Apr 2017 16:07:27 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix indenting warning in os_dep/os_intfs.c

Smatch logs the following warning:

  CHECK   drivers/staging/rtl8723bs/os_dep/os_intfs.c
drivers/staging/rtl8723bs/os_dep/os_intfs.c:1082 ips_netdrv_open() warn: inconsistent indenting

A simple change in the white space handles this warning.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix dereference before check warning in os_dep/recv_linux.c
Larry Finger [Sat, 8 Apr 2017 16:07:26 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix dereference before check warning in os_dep/recv_linux.c

Smatch lists the following warning:

  CHECK   drivers/staging/rtl8723bs/os_dep/recv_linux.c
drivers/staging/rtl8723bs/os_dep/recv_linux.c:353 rtw_recv_indicatepkt() warn: variable dereferenced before check 'precv_frame' (see line 312)

This warning is fixed by removing the test at line 353.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix indenting warning in os_dep/rtw_proc.c
Larry Finger [Sat, 8 Apr 2017 16:07:25 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix indenting warning in os_dep/rtw_proc.c

Smatch lists the following warning:

  CHECK   drivers/staging/rtl8723bs/os_dep/rtw_proc.c
drivers/staging/rtl8723bs/os_dep/rtw_proc.c:102 rtw_drv_proc_open() warn: inconsistent indenting

This warning is fixed with a simple change in the white space.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8723bs: Fix indenting warning in os_dep/xmit_linux.c
Larry Finger [Sat, 8 Apr 2017 16:07:24 +0000 (11:07 -0500)]
staging: rtl8723bs: Fix indenting warning in os_dep/xmit_linux.c

Smatch issues the warning

  CHECK   drivers/staging/rtl8723bs/os_dep/xmit_linux.c
drivers/staging/rtl8723bs/os_dep/xmit_linux.c:42 _rtw_pktfile_read() warn: inconsistent indenting

A simple indent changes fixes this.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoMerge branch 'for-linus' of git://git.kernel.dk/linux-block
Linus Torvalds [Sat, 8 Apr 2017 18:56:58 +0000 (11:56 -0700)]
Merge branch 'for-linus' of git://git.kernel.dk/linux-block

Pull block fixes from Jens Axboe:
 "Here's a pull request for 4.11-rc, fixing a set of issues mostly
  centered around the new scheduling framework. These have been brewing
  for a while, but split up into what we absolutely need in 4.11, and
  what we can defer until 4.12. These are well tested, on both single
  queue and multiqueue setups, and with and without shared tags. They
  fix several hangs that have happened in testing.

  This is obviously larger than I would have preferred at this point in
  time, but I don't think we can shave much off this and still get the
  desired results.

  In detail, this pull request contains:

   - a set of five fixes for NVMe, mostly from Christoph and one from
     Roland.

   - a series from Bart, fixing issues with dm-mq and SCSI shared tags
     and scheduling. Note that one of those patches commit messages may
     read like an optimization, but it is in fact an important fix for
     queue restarts in particular.

   - a series from Omar, most importantly fixing a hang with multiple
     hardware queues when we fail to get a driver tag. Another important
     fix in there is for resizing hardware queues, which nbd does when
     handling multiple sockets for one connection.

   - fixing an imbalance in putting the ctx for hctx request allocations
     from Minchan"

* 'for-linus' of git://git.kernel.dk/linux-block:
  blk-mq: Restart a single queue if tag sets are shared
  dm rq: Avoid that request processing stalls sporadically
  scsi: Avoid that SCSI queues get stuck
  blk-mq: Introduce blk_mq_delay_run_hw_queue()
  blk-mq: remap queues when adding/removing hardware queues
  blk-mq-sched: fix crash in switch error path
  blk-mq-sched: set up scheduler tags when bringing up new queues
  blk-mq-sched: refactor scheduler initialization
  blk-mq: use the right hctx when getting a driver tag fails
  nvmet: fix byte swap in nvmet_parse_io_cmd
  nvmet: fix byte swap in nvmet_execute_write_zeroes
  nvmet: add missing byte swap in nvmet_get_smart_log
  nvme: add missing byte swap in nvme_setup_discard
  nvme: Correct NVMF enum values to match NVMe-oF rev 1.0
  block: do not put mq context in blk_mq_alloc_request_hctx

7 years agoMerge tag 'pinctrl-v4.11-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
Linus Torvalds [Sat, 8 Apr 2017 18:43:38 +0000 (11:43 -0700)]
Merge tag 'pinctrl-v4.11-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl

Pull pin control fix from Linus Walleij:
 "This late fix for pin control is hopefully the last I send this cycle.

  The problem was detected early in the v4.11 release cycle and there
  has been some back and forth on how to solve it. Sadly the proper fix
  arrives late, but at least not too late.

  An issue was detected with pin control on the Freescale i.MX after the
  refactorings for more general group and function handling.

  We now have the proper fix for this"

* tag 'pinctrl-v4.11-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
  pinctrl: core: Fix pinctrl_register_and_init() with pinctrl_enable()

7 years agoMerge tag 'powerpc-4.11-7' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
Linus Torvalds [Sat, 8 Apr 2017 18:06:12 +0000 (11:06 -0700)]
Merge tag 'powerpc-4.11-7' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux

Pull powerpc fixes from Michael Ellerman:
 "Some more powerpc fixes for 4.11:

  Headed to stable:

   - disable HFSCR[TM] if TM is not supported, fixes a potential host
     kernel crash triggered by a hostile guest, but only in
     configurations that no one uses

   - don't try to fix up misaligned load-with-reservation instructions

   - fix flush_(d|i)cache_range() called from modules on little endian
     kernels

   - add missing global TLB invalidate if cxl is active

   - fix missing preempt_disable() in crc32c-vpmsum

  And a fix for selftests build changes that went in this release:

   - selftests/powerpc: Fix standalone powerpc build

  Thanks to: Benjamin Herrenschmidt, Frederic Barrat, Oliver O'Halloran,
  Paul Mackerras"

* tag 'powerpc-4.11-7' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
  powerpc/crypto/crc32c-vpmsum: Fix missing preempt_disable()
  powerpc/mm: Add missing global TLB invalidate if cxl is active
  powerpc/64: Fix flush_(d|i)cache_range() called from modules
  powerpc: Don't try to fix up misaligned load-with-reservation instructions
  powerpc: Disable HFSCR[TM] if TM is not supported
  selftests/powerpc: Fix standalone powerpc build

7 years agomm/mempolicy.c: fix error handling in set_mempolicy and mbind.
Chris Salls [Sat, 8 Apr 2017 06:48:11 +0000 (23:48 -0700)]
mm/mempolicy.c: fix error handling in set_mempolicy and mbind.

In the case that compat_get_bitmap fails we do not want to copy the
bitmap to the user as it will contain uninitialized stack data and leak
sensitive data.

Signed-off-by: Chris Salls <salls@cs.ucsb.edu>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
7 years agosysctl: report EINVAL if value is larger than UINT_MAX for proc_douintvec
Liping Zhang [Fri, 7 Apr 2017 15:51:07 +0000 (23:51 +0800)]
sysctl: report EINVAL if value is larger than UINT_MAX for proc_douintvec

Currently, inputting the following command will succeed but actually the
value will be truncated:

  # echo 0x12ffffffff > /proc/sys/net/ipv4/tcp_notsent_lowat

This is not friendly to the user, so instead, we should report error
when the value is larger than UINT_MAX.

Fixes: e7d316a02f68 ("sysctl: handle error writing UINT_MAX to u32 fields")
Signed-off-by: Liping Zhang <zlpnobody@gmail.com>
Cc: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
7 years agoMAINTAINERS: separate out kernfs maintainership
Tejun Heo [Thu, 23 Mar 2017 17:34:47 +0000 (13:34 -0400)]
MAINTAINERS: separate out kernfs maintainership

Separate out kernfs from driver core and add myself as a
co-maintainer.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agosysfs: be careful of error returns from ops->show()
NeilBrown [Mon, 3 Apr 2017 01:30:34 +0000 (11:30 +1000)]
sysfs: be careful of error returns from ops->show()

ops->show() can return a negative error code.
Commit 65da3484d9be ("sysfs: correctly handle short reads on PREALLOC attrs.")
(in v4.4) caused this to be stored in an unsigned 'size_t' variable, so errors
would look like large numbers.
As a result, if an error is returned, sysfs_kf_read() will return the
value of 'count', typically 4096.

Commit 17d0774f8068 ("sysfs: correctly handle read offset on PREALLOC attrs")
(in v4.8) extended this error to use the unsigned large 'len' as a size for
memmove().
Consequently, if ->show returns an error, then the first read() on the
sysfs file will return 4096 and could return uninitialized memory to
user-space.
If the application performs a subsequent read, this will trigger a memmove()
with extremely large count, and is likely to crash the machine is bizarre ways.

This bug can currently only be triggered by reading from an md
sysfs attribute declared with __ATTR_PREALLOC() during the
brief period between when mddev_put() deletes an mddev from
the ->all_mddevs list, and when mddev_delayed_delete() - which is
scheduled on a workqueue - completes.
Before this, an error won't be returned by the ->show()
After this, the ->show() won't be called.

I can reproduce it reliably only by putting delay like
usleep_range(500000,700000);
early in mddev_delayed_delete(). Then after creating an
md device md0 run
  echo clear > /sys/block/md0/md/array_state; cat /sys/block/md0/md/array_state

The bug can be triggered without the usleep.

Fixes: 65da3484d9be ("sysfs: correctly handle short reads on PREALLOC attrs.")
Fixes: 17d0774f8068 ("sysfs: correctly handle read offset on PREALLOC attrs")
Cc: stable@vger.kernel.org
Signed-off-by: NeilBrown <neilb@suse.com>
Acked-by: Tejun Heo <tj@kernel.org>
Reported-and-tested-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoDocumentation: stable-kernel-rules: fix stable-tag format
Johan Hovold [Mon, 3 Apr 2017 13:53:34 +0000 (15:53 +0200)]
Documentation: stable-kernel-rules: fix stable-tag format

A patch documenting how to specify which kernels a particular fix should
be backported to (seemingly) inadvertently added a minus sign after the
kernel version. This particular stable-tag format had never been used
prior to this patch, and was neither present when the patch in question
was first submitted (it was added in v2 without any comment).

Drop the minus sign to avoid any confusion.

Fixes: fdc81b7910ad ("stable_kernel_rules: Add clause about specification of kernel versions to patch.")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>