qseecom: Validate the incoming length from user space

Check if there is no integer overflow before using req_len and
resp_len (received from user space). If an overflow is detected
then exit the operation.

Change-Id: I0459a6992bb3b280db42be63a275c55fa6105b1c
Signed-off-by: Hariprasad Dhalinarasimha <hnamgund@codeaurora.org>
msm: ipc: Possible memory corruption due to Sign Conversion

msm_ipc_router_skb_to_buf() takes an unsigned argument and assigns the
same to a signed local variable. This might cause issues when the value
of the argument is too high.

Change the datatype of the local variable to unsigned.

CRs-Fixed: 550606
Change-Id: I257a095681dd82fba05367fd6faf25820e95c719
Signed-off-by: Zaheerulla Meer <zmeer@codeaurora.org>
platform: qpnp-power-on: Set boot reason in procfs

Assigns a value to the boot_reason procfs property in
qpnp-power-on. This property can be read via
/proc/sys/kernel/boot_reason. The value for this property
will reflect lowest bit set in the PON_REASON1 PMIC register.
For example, if bit 0 is set in the register, then
boot_reason will have a value of 1. If no bits are set
in the register, then boot_reason will have a value of 0.

For existing PMIC chips, the following mapping applies
for the value of boot_reason:

0 -> unknown
1 -> hard reset
2 -> sudden momentary power loss (SMPL)
3 -> real time clock (RTC)
4 -> DC charger inserted
5 -> USB charger inserted
6 -> PON1 pin toggled (for secondary PMICs)
7 -> CBLPWR_N pin toggled (for external power supply)
8 -> KPDPWR_N pin toggled (power key pressed)

Change-Id: Icf2be66165fd01d3063282fcbfb2b115480e7b5c
Signed-off-by: Maria Yu <aiquny@codeaurora.org>
Merge "platform: qpnp-power-on: Set boot reason in procfs"
Merge "qseecom: Validate the incoming length from user space"
diag: dci: Safeguard to prevent integer overflow

At certain point in diag driver there can be integer overflow
thus can lead to memory leak. Added a safegaurd for it.

Change-Id: I9347405d8f1f95ed42fe0abf35cbf4c362281bdf
CRs-fixed: 565160
Signed-off-by: Katish Paran <kparan@codeaurora.org>
kernel: alarm: setup the RTC immediately for poweroff alarm

Currently we setup the RTC for poweroff alarm when the system
performs shutdown. But if the phone is shut down unexpectedly
before that, the poweroff alarm can't work. So we can do that
immediately.

CR-fixed: 532743
Change-Id: Ib26a56fba8cd64efe94f2f07ee232482228429dc
Signed-off-by: Figo Wang <figow@codeaurora.org>
Merge "kernel: alarm: setup the RTC immediately for poweroff alarm"
Merge "msm: ipc: Possible memory corruption due to Sign Conversion"
Merge "diag: dci: Safeguard to prevent integer overflow"