tracing/syscalls: Fix perf syscall tracing when syscall_nr == -1

syscall_get_nr can return -1 in the case that the task is not executing
a system call.

This patch fixes perf_syscall_{enter,exit} to check that the syscall
number is valid before using it as an index into a bitmap.

Link: http://lkml.kernel.org/r/1345137254-7377-1-git-send-email-will.deacon@arm.com

Change-Id: Iedc719957e184c6572b3ad94e241ae2a97a0b533
Cc: Jason Baron <jbaron@redhat.com>
Cc: Wade Farnsworth <wade_farnsworth@mentor.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
tracing/syscalls: Ignore numbers outside NR_syscalls' range

ARM has some private syscalls (for example, set_tls(2)) which lie
outside the range of NR_syscalls.  If any of these are called while
syscall tracing is being performed, out-of-bounds array access will
occur in the ftrace and perf sys_{enter,exit} handlers.

 # trace-cmd record -e raw_syscalls:* true && trace-cmd report
 ...
 true-653   [000]   384.675777: sys_enter:            NR 192 (0, 1000, 3, 4000022, ffffffff, 0)
 true-653   [000]   384.675812: sys_exit:             NR 192 = 1995915264
 true-653   [000]   384.675971: sys_enter:            NR 983045 (76f74480, 76f74000, 76f74b28, 76f74480, 76f76f74, 1)
 true-653   [000]   384.675988: sys_exit:             NR 983045 = 0
 ...

 # trace-cmd record -e syscalls:* true
 [   17.289329] Unable to handle kernel paging request at virtual address aaaaaace
 [   17.289590] pgd = 9e71c000
 [   17.289696] [aaaaaace] *pgd=00000000
 [   17.289985] Internal error: Oops: 5 [#1] PREEMPT SMP ARM
 [   17.290169] Modules linked in:
 [   17.290391] CPU: 0 PID: 704 Comm: true Not tainted 3.18.0-rc2+ #21
 [   17.290585] task: 9f4dab00 ti: 9e710000 task.ti: 9e710000
 [   17.290747] PC is at ftrace_syscall_enter+0x48/0x1f8
 [   17.290866] LR is at syscall_trace_enter+0x124/0x184

Fix this by ignoring out-of-NR_syscalls-bounds syscall numbers.

Commit cd0980fc8add "tracing: Check invalid syscall nr while tracing syscalls"
added the check for less than zero, but it should have also checked
for greater than NR_syscalls.

Link: http://lkml.kernel.org/p/1414620418-29472-1-git-send-email-rabin@rab.in

Fixes: cd0980fc8add "tracing: Check invalid syscall nr while tracing syscalls"
Cc: stable@vger.kernel.org # 2.6.33+
Signed-off-by: Rabin Vincent <rabin@rab.in>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

Conflicts:
	kernel/trace/trace_syscalls.c

Change-Id: I512142f8f1e1b2a8dc063209666dbce9737377e7
msm: pmapp: Close RPC client properly upon RPC failure.

When the RPC call fails, pm->endpoint is set to NULL without deregistering the
corresponding RPC endpoint.

Change-Id: If08614981a63ac3bad3f218b25e1a7e7947a642b
msm: pmapp: Retry RPC connection on specific error messages.

Errors such as -EAGAIN, -EBUSY, -ETIMEDOUT are normally temporary. On these
error cases, sleep for 50ms and retry up to 10 times.

Change-Id: I8454e0ab136bc7a44ed299595690e201125941bf
msm_fb: Suppress a log message.

It's way too intrusive when switching the display on.

Change-Id: Ie65179696ddb4fb238f03b659c73b06a772d2dfc
bcmdhd: Remove driver.
bcmdhd: Squashed update from AOSP kernel/common/android-3.4

Update up to: 'net: wireless: bcmdhd: Disable OOB interrupt when WLAN is off'
bcmdhd: Fix build with CONFIG_DHD_USE_SCHED_SCAN disabled
bcmdhd: fix crash when p2p is not supported by firmware. Fixes bcm4329

Signed-off-by: Michael Bestas <mikeioannina@gmail.com>
bcmdhd: Fix kernel panics

From Samsung bcm4329 code.
https://github.com/arco/samsung-kernel-msm7x30/commit/e982aa4aa156a5f725b2a4c00fe22473182e7ff2
net: wireless: bcmdhd: Fix data CRC errors

It is probable that enable the CMD14 in sd bus, creates problems.
In the old version of the driver is used only in the BCM4330 chipset.

dmesg:
<3>[  127.747741] mmc0: Data CRC error
<3>[  127.747863] msmsdcc_data_err: opcode 0x00000035
<3>[  127.747924] msmsdcc_data_err: blksz 4, blocks 1
zeus: Initial bcmdhd configuration

* Based on huawei u8860 work from @Blefish
* Modified GPIOs according to R800 schematics
* MAC address not implemented yet

Change-Id: I2deaba07952d43a6d7b1adce0935ce443ee9c9f4
defconfig: zeus: Enable bcmdhd & dependencies

Change-Id: I924e290256ef7130333ba44c372692951a7850cc
zeus: Initial bcm4329 bluetooth configuration

* Based on huawei u8860 work from @Blefish
* Modified GPIOs according to R800 schematics

Change-Id: I503f6e4924ac5b1b2aa676148b3c98b30cdf5126
defconfigs: zeus: Changes for bcm4329 BT

Change-Id: Ib2e08745e76908b2dcb99d9e14864bede232f18d
bluesleep: implement to support bluedroid

"#define BT_BLUEDROID_SUPPORT 1" -> support BlueDroid
"#define BT_BLUEDROID_SUPPORT 0" -> support BlueZ

Since BlueDroid does not use kernel space HCI driver now, we add the
below 2 /proc nodes to make BlueDroid able to send HCI events to
bluesleep driver.

write 1 to /proc/bluetooth/sleep/lpm -> equivalent to HCI_DEV_REG event
write 0 to /proc/bluetooth/sleep/lpm -> equivalent to HCI_DEV_UNREG event
write 1 to /proc/bluetooth/sleep/btwrite -> equivalent to HCI_DEV_WRITE event

Change-Id: Ifce4d483a2fc934f19d198a2c093b0b5552d02a3
Signed-off-by: Haley Teng <hteng@nvidia.com>
bluetooth: bluesleep: Fix compile
zeus: Add Bluesleep

Change-Id: I70a6af52f04a4722e2a878ccbf9e74216dff2cbf
defconfigs: zeus: Enable Bluesleep

Change-Id: I69ce64f3c87e5b5f5e70416289a5a67e37f5c130
mogami: Remove unused VPE code

* Mogami uses standalone VPE

Change-Id: I06326127191c89a1d2ef74589a6b07516c0c4035