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.
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>
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.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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
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
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
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.
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()
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>
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>
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>
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>
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>
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>
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>
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>
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
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()
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
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>
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>
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>
staging: fsl-mc/dpio: Fix early writing of valid bit
Commands written to the QMan software portals have a valid
bit in the "verb" field of the command that, when set with
the right value, notifies the hardware that the command is
fully written and ready to be processed.
The "verb" field should be the last one to be written in the
swp command registers, after all other fields are filled in.
The current implementation doesn't follow this rule for all
commands, which may result in an incompletely configured
command being processed by the hardware. Enforce the correct
order of writes to avoid this situation.
Alex Wilson [Thu, 30 Mar 2017 07:16:02 +0000 (01:16 -0600)]
staging: fbtft: fix type assignment warning
Sparse spits out a warning that a __be16 was being assigned to a u16.
Change the type of txbuf16 to __be16 b/c it's a restricted type and
prevents mixing endianness.
Signed-off-by: Alex Wilson <alex.david.wilson@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Tue, 4 Apr 2017 10:32:27 +0000 (11:32 +0100)]
staging: comedi: amplc_pci224: convert CLK_CONFIG() macro to function
Convert the `CLK_CLKFIG(chan, src)` macro to a static function
`pci224_clk_config(chan, src)`. This is consistent with an earlier
change to convert `GAT_CONFIG(chan, src)` to a static function.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Tue, 4 Apr 2017 10:29:54 +0000 (11:29 +0100)]
staging: comedi: amplc_pci230: convert CLK_CONFIG() macro to function
Convert the `CLK_CONFIG(chan, src)` macro to a static function
`pci230_clk_config(chan, src)`. This is consistent with an earlier
change to convert `GAT_CONFIG(chan, src)` to a static function.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>