seq_file: remove "%n" usage from seq_file users

All seq_printf() users are using "%n" for calculating padding size,
convert them to use seq_setwidth() / seq_pad() pair.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Joe Perches <joe@perches.com>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Git-commit: 652586df95e5d76b37d07a11839126dcfede1621
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
[rsiddoji@codeaurora.org: Resolve merge conflicts with ipv4/6 ping
 changes in upstream]
CRs-fixed: 665291
Change-Id: Ia0416c9dbe3d80ff35f24f9c93c3543d1200a327
Signed-off-by: Ravi Kumar <rsiddoji@codeaurora.org>
target/rd: Refactor rd_build_device_space + rd_release_device_space

This patch refactors rd_build_device_space() + rd_release_device_space()
into rd_allocate_sgl_table() + rd_release_device_space() so that they
may be used seperatly for setup + release of protection information
scatterlists.

Also add explicit memset of pages within rd_allocate_sgl_table() based
upon passed 'init_payload' value.

v2 changes:
  - Drop unused sg_table from rd_release_device_space (Wei)

Change-Id: I0d42113c0e2d703fe7567a804003b034fd4fa0b7
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Sagi Grimberg <sagig@mellanox.com>
Cc: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Git-commit:4442dc8a92b8f9ad8ee9e7f8438f4c04c03a22dc
Git-repo:https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git
[ggober@codeaurora.org:resolve trivial merge conflicts in target_core_rd.c]
Signed-off-by: Gopal G Goberu <ggober@codeaurora.org>
defconfig: Enable bridging and ebtables

This patch enables bridging and ebtables BROUTING support
for IPv6 tethering

Change-Id: Iac394e1f89e3976a971524a453927057bf868d50
Signed-off-by: Ravinder Konka <rkonka@codeaurora.org>
qseecom:  Add checks for send_cmd inputs

Improve user input validation across send cmd APIs. Add new
API  __validate_send_cmd_inputs() to validate all user provided
inputs.

Change-Id: Ibbb0c0e7e5483f653bd59b927562b63c1e43c365
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
Merge "seq_file: remove "%n" usage from seq_file users"
nl80211: check nla_put_* return values

Coverity pointed out that in a few functions we don't
check the return value of the nla_put_*() calls. Most
of these are fairly harmless because the input isn't
very dynamic and controlled by the kernel, but the
pattern is simply wrong, so fix this.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Git-commit: ae917c9f55862691e31b84de7ec29bedcb83971c
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Change-Id: I571d29b19efa1090b2d8560b57f5f28777f129b0
Signed-off-by: Ahmad Kholaif <akholaif@codeaurora.org>
Merge "target/rd: Refactor rd_build_device_space + rd_release_device_space"
Merge "nl80211: check nla_put_* return values"
Merge "qseecom:  Add checks for send_cmd inputs"
dtc: add integer overflow checks in fdt header

Protect against integer overflows caused by malformed fdt headers.

CRs-Fixed: 749977
Change-Id: I51d87038f520bc761b163d291b0138c513c69a33
Signed-off-by: Vijay Kumar Pendoti <vpendo@codeaurora.org>
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
Merge "defconfig: Enable bridging and ebtables"
Merge "dtc: add integer overflow checks in fdt header"
 SoC: msm: Add Buffer overflow check

The overflow check is required to ensure that user space data
in kernel may not go beyond buffer boundary.

CRs-Fixed: 563086
Signed-off-by: Asish Bhattacharya <asishb@codeaurora.org>
Signed-off-by: Mohammad Johny Shaik <mjshai@codeaurora.org>
(cherry picked from commit 7e09949355b2dac9aac8bb414037ccaca3c68d86)
Signed-off-by: Pavan Chikkala <pavanc@codeaurora.org>

Change-Id: I4da774740c71b97dc2e4fd16c78bf065ad457690
Signed-off-by: Pavan Chikkala <pavanc@codeaurora.org>
msm: HTC: m4: Don't map the entire heap into IOMMU

CAF only ever set these flags on 8960, and the HTC source I have here
doesn't do it either. As a bonus, the heap alignment is wrong for this
usecase, so it worked largely by chance.

Change-Id: Id96611ba6037486b1b78da60c4d144606eabc55b
Merge " SoC: msm: Add Buffer overflow check"
msm: HTC: m4: Fix typo in qseecom bus scaling data

Lifted from c00d25c20c in CAF.

Change-Id: I491c494d1525c671884d27ed8f083c98f048f5da
msm: HTC: m7: Enable idletimer

Change-Id: I28ae35543376c0de2c1325b1e3810b8091d2b566
msm: HTC: t6: Enable idletimer

Change-Id: I18e6a7a8ad282dad0002bc85676a2c1f32579417
Merge remote-tracking branch 'caf/LA.AF.1.1_rb1.7' into cm-12.0

Conflicts:
	drivers/misc/qseecom.c
	fs/proc/task_mmu.c
	include/net/tcp.h
	net/ipv4/syncookies.c
	net/ipv6/route.c
	net/ipv6/tcp_ipv6.c

Change-Id: I8a953e9f483a24ee45f5e1c570b6a4f92e87c6e9
Add PR_{GET,SET}_NO_NEW_PRIVS to prevent execve from granting privs

With this change, calling
  prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)
disables privilege granting operations at execve-time.  For example, a
process will not be able to execute a setuid binary to change their uid
or gid if this bit is set.  The same is true for file capabilities.

Additionally, LSM_UNSAFE_NO_NEW_PRIVS is defined to ensure that
LSMs respect the requested behavior.

To determine if the NO_NEW_PRIVS bit is set, a task may call
  prctl(PR_GET_NO_NEW_PRIVS, 0, 0, 0, 0);
It returns 1 if set and 0 if it is not set. If any of the arguments are
non-zero, it will return -1 and set errno to -EINVAL.
(PR_SET_NO_NEW_PRIVS behaves similarly.)

This functionality is desired for the proposed seccomp filter patch
series.  By using PR_SET_NO_NEW_PRIVS, it allows a task to modify the
system call behavior for itself and its child tasks without being
able to impact the behavior of a more privileged task.

Another potential use is making certain privileged operations
unprivileged.  For example, chroot may be considered "safe" if it cannot
affect privileged tasks.

Note, this patch causes execve to fail when PR_SET_NO_NEW_PRIVS is
set and AppArmor is in use.  It is fixed in a subsequent patch.

Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: Will Drewry <wad@chromium.org>
Acked-by: Eric Paris <eparis@redhat.com>
Acked-by: Kees Cook <keescook@chromium.org>

Change-Id: I2159006d20daefe6add5adc47c22bdbcd7d79e3a
v18: updated change desc
v17: using new define values as per 3.4
Signed-off-by: James Morris <james.l.morris@oracle.com>