profile/mobile/platform/kernel/linux-3.10-sc7730.git
4 years agogen_init_cpio: avoid NULL pointer dereference and rework env expanding 46/219946/4
Michal Nazarewicz [Tue, 12 Nov 2013 23:08:41 +0000 (15:08 -0800)]
gen_init_cpio: avoid NULL pointer dereference and rework env expanding

getenv() may return NULL if given environment variable does not exist
which leads to NULL dereference when calling strncat.

Besides that, the environment variable name was copied to a temporary
env_var buffer, but this copying can be avoided by simply using the input
string.

Lastly, the whole loop can be greatly simplified by using the snprintf
function instead of the playing with strncat.

 By the way, the current implementation allows a recursive variable
 expansion, as in:

   $ echo 'out ${A} out ' | A='a ${B} a' B=b /tmp/a
   out a b a out

 I'm assuming this is just a side effect and not a conscious decision
 (especially as this may lead to infinite loop), but I didn't want to
 change this behaviour without consulting.

 If the current behaviour is deamed incorrect, I'll be happy to send
 a patch without recursive processing.

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Jesper Juhl <jj@codesealer.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[dongkyun.s: cherry-pick mainline commit c725ee54c30b for gcc 9 build]
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
Change-Id: I16e6c2691b3e67651de4bee374c1fab87606337c

4 years agogive up on gcc ilog2() constant optimizations 44/219944/3
Linus Torvalds [Thu, 2 Mar 2017 20:17:22 +0000 (12:17 -0800)]
give up on gcc ilog2() constant optimizations

gcc-7 has an "optimization" pass that completely screws up, and
generates the code expansion for the (impossible) case of calling
ilog2() with a zero constant, even when the code gcc compiles does not
actually have a zero constant.

And we try to generate a compile-time error for anybody doing ilog2() on
a constant where that doesn't make sense (be it zero or negative).  So
now gcc7 will fail the build due to our sanity checking, because it
created that constant-zero case that didn't actually exist in the source
code.

There's a whole long discussion on the kernel mailing about how to work
around this gcc bug.  The gcc people themselevs have discussed their
"feature" in

   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72785

but it's all water under the bridge, because while it looked at one
point like it would be solved by the time gcc7 was released, that was
not to be.

So now we have to deal with this compiler braindamage.

And the only simple approach seems to be to just delete the code that
tries to warn about bad uses of ilog2().

So now "ilog2()" will just return 0 not just for the value 1, but for
any non-positive value too.

It's not like I can recall anybody having ever actually tried to use
this function on any invalid value, but maybe the sanity check just
meant that such code never made it out in public.

Reported-by: Laura Abbott <labbott@redhat.com>
Cc: John Stultz <john.stultz@linaro.org>,
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[dongkyun.s: cherry-pick mainline commit 474c90156c8d for gcc 9 build]
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
Change-Id: Ie054a0dce237f09ddc56f0e3b5973798b28e0aae

4 years agoSmack: Verify read access on file open - v3 91/212291/1 accepted/tizen_5.5_unified accepted/tizen_5.5_unified_mobile_hotfix accepted/tizen_5.5_unified_wearable_hotfix tizen_5.5 tizen_5.5_mobile_hotfix tizen_5.5_tv tizen_5.5_wearable_hotfix accepted/tizen/5.5/unified/20191031.033829 accepted/tizen/5.5/unified/mobile/hotfix/20201027.070928 accepted/tizen/5.5/unified/wearable/hotfix/20201027.094753 accepted/tizen/unified/20190821.111104 submit/tizen/20190821.055225 submit/tizen_5.5/20191031.000010 submit/tizen_5.5/20191031.000011 submit/tizen_5.5/20191031.000013 submit/tizen_5.5_mobile_hotfix/20201026.185109 submit/tizen_5.5_wearable_hotfix/20201026.184309 tizen_5.5.m2_release
Casey Schaufler [Mon, 21 Apr 2014 18:10:26 +0000 (11:10 -0700)]
Smack: Verify read access on file open - v3

Smack believes that many of the operatons that can
be performed on an open file descriptor are read operations.
The fstat and lseek system calls are examples.
An implication of this is that files shouldn't be open
if the task doesn't have read access even if it has
write access and the file is being opened write only.

Targeted for git://git.gitorious.org/smack-next/kernel.git

Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
[sw0312.kim: cherry-pick mainline commit a6834c0b9114 to apply open to read access]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Ifafc642de9393f45e2b0aabd94bb1058bbe99af6

4 years agoARM: tizen_tm1_defconfig: enable MATCH_OWNER xtables module 04/211204/2 accepted/tizen/unified/20190801.113441 submit/tizen/20190801.010047
Lukasz Pawelczyk [Mon, 29 Jul 2019 11:43:12 +0000 (13:43 +0200)]
ARM: tizen_tm1_defconfig: enable MATCH_OWNER xtables module

Enable the MATCH_OWNER xtables module to be compiled for using
xt_owner supplementary groups.

Change-Id: I188f140b83b6ab0c0f546f77a67d0cbedfafab49
Signed-off-by: Lukasz Pawelczyk <l.pawelczyk@samsung.com>
[sw0312.kim: split patch for backport and change of defconfig]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agonetfilter: xt_owner: A fix for backport of 'xt_owner: Add supplementary groups option' 59/211059/3
Lukasz Pawelczyk [Mon, 29 Jul 2019 11:43:12 +0000 (13:43 +0200)]
netfilter: xt_owner: A fix for backport of 'xt_owner: Add supplementary groups option'

This patch fixes the backport of 'netfilter: xt_owner: Add
supplementary groups option' (97f200a99f31).

Change-Id: Iad7b418057c27b95bf04b12d042bb604bd721997
Signed-off-by: Lukasz Pawelczyk <l.pawelczyk@samsung.com>
[sw0312.kim: split fix for backport and change of defconfig]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agonetfilter: xt_owner: bail out with EINVAL in case of unsupported flags 05/209205/1 accepted/tizen/unified/20190705.110612 submit/tizen/20190705.061120
Pablo Neira Ayuso [Fri, 7 Jun 2019 14:37:30 +0000 (16:37 +0200)]
netfilter: xt_owner: bail out with EINVAL in case of unsupported flags

Reject flags that are not supported with EINVAL.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
[sw0312.kim: backport from mainline to support supplementary groups on netfilter]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I6d86e2db548445d29405fb9cbec540f7d1a196ef

4 years agonetfilter: xt_owner: Add supplementary groups option 04/209204/1
Lukasz Pawelczyk [Fri, 10 May 2019 11:46:22 +0000 (13:46 +0200)]
netfilter: xt_owner: Add supplementary groups option

The XT_OWNER_SUPPL_GROUPS flag causes GIDs specified with XT_OWNER_GID
to be also checked in the supplementary groups of a process.

f_cred->group_info cannot be modified during its lifetime and f_cred
holds a reference to it so it's safe to use.

Signed-off-by: Lukasz Pawelczyk <l.pawelczyk@samsung.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
[sw0312.kim: backport from mainline to apply supplementary groups on netfilter]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Ib0e14affa03a612ea85dd409a2de00d7d2cbb061

5 years agoinput: ist3xx: Fixes string buffer overflow 91/206091/3 accepted/tizen/unified/20190515.085003 submit/tizen/20190514.075217
Jaechul Lee [Tue, 14 May 2019 07:19:29 +0000 (16:19 +0900)]
input: ist3xx: Fixes string buffer overflow

The string buffer has page size but sizeof returns 4.

Fixes: 81925d011289 ("input: ist3xx: replace misused strncat with s(n)printf")
Change-Id: Ia2272b385e510fd5a4df944ce19b3fe64220896a
Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
5 years agomedia: radio: sprd: fix only requesting to get snr when used 86/206086/1
Seung-Woo Kim [Tue, 14 May 2019 07:01:04 +0000 (16:01 +0900)]
media: radio: sprd: fix only requesting to get snr when used

When not used, requesting to get snr causes following kernel panic
because driver is not initialized. Fix only requesting to get snr
when used.

   Internal error: Oops: 805 [#1] PREEMPT SMP ARM
   ...
   [<c05a9fd8>] (skb_queue_tail+0x34/0x58) from [<c047e7e4>] (__fm_send_cmd.isra.0+0xcc/0xf8)
   [<c047e7e4>] (__fm_send_cmd.isra.0+0xcc/0xf8) from [<c047ea5c>] (fmc_send_cmd+0x6c/0x210)
   [<c047ea5c>] (fmc_send_cmd+0x6c/0x210) from [<c0482764>] (fm_rx_get_snr+0x4c/0x84)
   [<c0482764>] (fm_rx_get_snr+0x4c/0x84) from [<c0480ad4>] (show_fmrx_curr_snr+0x34/0x6c)
   [<c0480ad4>] (show_fmrx_curr_snr+0x34/0x6c) from [<c0308264>] (dev_attr_show+0x30/0x54)
   [<c0308264>] (dev_attr_show+0x30/0x54) from [<c0172498>] (sysfs_read_file+0xc0/0x170)
   [<c0172498>] (sysfs_read_file+0xc0/0x170) from [<c01160b8>] (vfs_read+0xbc/0x138)
   [<c01160b8>] (vfs_read+0xbc/0x138) from [<c01166a8>] (SyS_read+0x50/0x78)
   [<c01166a8>] (SyS_read+0x50/0x78) from [<c000fa4c>] (__sys_trace_return+0x0/0x14)

Change-Id: I6ada090c40925212ef96107d56021612c5cf46fe
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
5 years agopackaging: fix to strip kernel modules 85/206085/1
Seung-Woo Kim [Tue, 14 May 2019 07:07:52 +0000 (16:07 +0900)]
packaging: fix to strip kernel modules

Fix to strip kernel modules with INSTALL_MOD_STRIP=1 option for
modules_install.

Change-Id: I9e15dedadd46506d368231c22fef12dabdc61d55
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
5 years agobuild: scripts: fix to strip kernel modules 84/206084/1
Seung-Woo Kim [Tue, 14 May 2019 07:05:40 +0000 (16:05 +0900)]
build: scripts: fix to strip kernel modules

Fix to strip kernel modules from build script.

Change-Id: I25f79594813ea6220f98175daee3d4de58e3af38
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
5 years agousb: gadget: f_fs: remove global epin/epout fileio completion 61/190561/5 accepted/tizen_5.0_unified accepted/tizen/5.0/unified/20181106.202900 accepted/tizen/unified/20181011.095032 submit/tizen/20181011.060219 submit/tizen_5.0/20181101.000009 submit/tizen_5.0/20181106.000001
INSUN PYO [Thu, 4 Oct 2018 01:26:22 +0000 (10:26 +0900)]
usb: gadget: f_fs: remove global epin/epout fileio completion

In product code, global epin/epi fileio completion is applied but
if more than one multiple instance of functionfs are used, the
global completions cause transfer error. Remove global epin/epout
fileio to resolve transfer error in functionfs.

Change-Id: Ic71b34bbc83e0cfd9e76321fc4b8f86c2e259bfd
Signed-off-by: INSUN PYO <insun.pyo@samsung.com>
[sw0312.kim: rebase and remove related unnecessary part also]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
5 years agoARM: tizen_tm1_defconfig: enable FUNCTION_TRACER 63/190563/1
Seung-Woo Kim [Thu, 4 Oct 2018 01:43:08 +0000 (10:43 +0900)]
ARM: tizen_tm1_defconfig: enable FUNCTION_TRACER

To trace kernel function calls, enable FUNCTION_TRACER config.

Change-Id: I6caabf29f26f2b7340c4a1358e7f619775269e9c
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
5 years agoinput: mms134s: remove unnecessary KERN log level from pr_* functions 29/190429/1
Seung-Woo Kim [Tue, 2 Oct 2018 01:40:22 +0000 (10:40 +0900)]
input: mms134s: remove unnecessary KERN log level from pr_* functions

Remove unnecessary KERN log level from pr_* functions.

Change-Id: If97b8c96d0f011b0b4f6a7fd24dd91fe819123c0
Reported-by: Insun Pyo <insun.pyo@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
5 years agosprd: remove unnecessary KERN log level from pr_* functions 28/190428/1
Seung-Woo Kim [Tue, 2 Oct 2018 01:36:38 +0000 (10:36 +0900)]
sprd: remove unnecessary KERN log level from pr_* functions

Remove unnecessary KERN log level from pr_* functions.

Change-Id: I67d1315fe0d51450ea16c2340aff81fd8049040d
Reported-by: Insun Pyo <insun.pyo@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
5 years agoHID: samsung: move unexecuted statements 51/188551/1
Seung-Woo Kim [Thu, 6 Sep 2018 02:39:50 +0000 (11:39 +0900)]
HID: samsung: move unexecuted statements

In game pad event handling, there are unexecuted statements
because of wrong position. Move the statements properly.

Change-Id: Ifc7240718231539020119743fb7fb5fb8d5d0e7b
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
5 years agopower: load_analyzer: fix pointer-compare build warning 50/188550/1
Seung-Woo Kim [Thu, 6 Sep 2018 02:36:45 +0000 (11:36 +0900)]
power: load_analyzer: fix pointer-compare build warning

Fix following pointer-compare build warning with gcc 7:
In file included from drivers/power/load_analyzer_main.c:79:0:
   drivers/power/load_analyzer_input.c: In function ‘input_rec_store_input_dev_info’:
   drivers/power/load_analyzer_input.c:32:17: warning: comparison between pointer and zero character constant [-Wpointer-compare]
      if (dev->name == '\0')
                    ^~
   drivers/power/load_analyzer_input.c:32:7: note: did you mean to dereference the pointer?
      if (dev->name == '\0')
          ^

Change-Id: I48c4028cb8ff5ddd9d23288f4d452f0eb14eb692
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
5 years agodisable new gcc-7.1.1 warnings for now 49/188549/1
Linus Torvalds [Thu, 13 Jul 2017 02:25:47 +0000 (19:25 -0700)]
disable new gcc-7.1.1 warnings for now

I made the mistake of upgrading my desktop to the new Fedora 26 that
comes with gcc-7.1.1.

There's nothing wrong per se that I've noticed, but I now have 1500
lines of warnings, mostly from the new format-truncation warning
triggering all over the tree.

We use 'snprintf()' and friends in a lot of places, and often know that
the numbers are fairly small (ie a controller index or similar), but gcc
doesn't know that, and sees an 'int', and thinks that it could be some
huge number.  And then complains when our buffers are not able to fit
the name for the ten millionth controller.

These warnings aren't necessarily bad per se, and we probably want to
look through them subsystem by subsystem, but at least during the merge
window they just mean that I can't even see if somebody is introducing
any *real* problems when I pull.

So warnings disabled for now.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[sw0312.kim: cherry-pick from mainline to fix build warning with gcc 7]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Idfb16c6d8a06d040acb3488fe1d304ca8468dc24

5 years agoARM: tizen_tm1_defconfig: enable SND_USB_AUDIO 08/188408/1 accepted/tizen/unified/20180906.054627 submit/tizen/20180906.010119
Jaechul Lee [Tue, 4 Sep 2018 23:06:24 +0000 (08:06 +0900)]
ARM: tizen_tm1_defconfig: enable SND_USB_AUDIO

SND_USB_AUDIO configuration is enabled for supporting usb audio devices.

Change-Id: I9d298e4723b472622b95158649abc24a5c3e4d1f
Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
5 years agoBluetooth: Report RPA changed event 73/185973/2 accepted/tizen/unified/20180808.141328 submit/tizen/20180808.061203
injun.yang [Mon, 21 May 2018 08:32:16 +0000 (17:32 +0900)]
Bluetooth: Report RPA changed event

When RPA changed, The updated RPA is not applied on
VSC advertising. This patchset generates new event
and resolves the problem.

Change-Id: Icc3dd74da0449cb8e456c27bc34995f43326efe1
Signed-off-by: injun.yang <injun.yang@samsung.com>
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
5 years agoBluetooth: Fix hci unintended disconnect issue 87/181587/2
Wootak Jung [Fri, 15 Jun 2018 02:01:59 +0000 (11:01 +0900)]
Bluetooth: Fix hci unintended disconnect issue

hci connection is disconnected unintentionally because of
short timer in case link key is existing on legacy pairing mode.
Fix timer regardless of existence of link key.

Change-Id: Id66362347d89fdd3e2914a13df98e8e14e558fea
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
5 years agoUSB: core: Add type-specific length check of BOS descriptors 93/179693/2 accepted/tizen/unified/20180619.141837 submit/tizen/20180615.023254
Masakazu Mokuno [Thu, 9 Nov 2017 16:25:50 +0000 (01:25 +0900)]
USB: core: Add type-specific length check of BOS descriptors

commit 81cf4a45360f70528f1f64ba018d61cb5767249a upstream.

As most of BOS descriptors are longer in length than their header
'struct usb_dev_cap_header', comparing solely with it is not sufficient
to avoid out-of-bounds access to BOS descriptors.

This patch adds descriptor type specific length check in
usb_get_bos_descriptor() to fix the issue.

Signed-off-by: Masakazu Mokuno <masakazu.mokuno@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[bwh: Backported to 3.16: drop handling of USB_PTM_CAP_TYPE and USB_SSP_CAP_TYPE]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
[sw0312.kim: cherry-pick from linux-3.16.y to fix usb issue related with CVE-2017-16531]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Id446c97db292f11c48895b95e756bb0c7104a43b

5 years agoUSB: core: prevent malicious bNumInterfaces overflow 92/179692/2
Alan Stern [Tue, 12 Dec 2017 19:25:13 +0000 (14:25 -0500)]
USB: core: prevent malicious bNumInterfaces overflow

commit 48a4ff1c7bb5a32d2e396b03132d20d552c0eca7 upstream.

A malicious USB device with crafted descriptors can cause the kernel
to access unallocated memory by setting the bNumInterfaces value too
high in a configuration descriptor.  Although the value is adjusted
during parsing, this adjustment is skipped in one of the error return
paths.

This patch prevents the problem by setting bNumInterfaces to 0
initially.  The existing code already sets it to the proper value
after parsing is complete.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
[sw0312.kim: cherry-pick from linux-3.16.y to fix usb issue related with CVE-2017-16531]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Id256d4802f9db3013b7abcc19652304e1c5a2b2f

5 years agoUSB: core: fix out-of-bounds access bug in usb_get_bos_descriptor() 91/179691/2
Alan Stern [Wed, 18 Oct 2017 16:49:38 +0000 (12:49 -0400)]
USB: core: fix out-of-bounds access bug in usb_get_bos_descriptor()

commit 1c0edc3633b56000e18d82fc241e3995ca18a69e upstream.

Andrey used the syzkaller fuzzer to find an out-of-bounds memory
access in usb_get_bos_descriptor().  The code wasn't checking that the
next usb_dev_cap_header structure could fit into the remaining buffer
space.

This patch fixes the error and also reduces the bNumDeviceCaps field
in the header to match the actual number of capabilities found, in
cases where there are fewer than expected.

Reported-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Tested-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
[sw0312.kim: cherry-pick from linux-3.16.y to fix usb issue related with CVE-2017-16531]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I85edcdcda17564d1c2e92e6980d27b34eacb5d4b

5 years agoUSB: fix out-of-bounds in usb_set_configuration 90/179690/2
Greg Kroah-Hartman [Tue, 19 Sep 2017 13:07:17 +0000 (15:07 +0200)]
USB: fix out-of-bounds in usb_set_configuration

commit bd7a3fe770ebd8391d1c7d072ff88e9e76d063eb upstream.

Andrey Konovalov reported a possible out-of-bounds problem for a USB interface
association descriptor.  He writes:
It seems there's no proper size check of a USB_DT_INTERFACE_ASSOCIATION
descriptor. It's only checked that the size is >= 2 in
usb_parse_configuration(), so find_iad() might do out-of-bounds access
to intf_assoc->bInterfaceCount.

And he's right, we don't check for crazy descriptors of this type very well, so
resolve this problem.  Yet another issue found by syzkaller...

Reported-by: Andrey Konovalov <andreyknvl@google.com>
Tested-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
[sw0312.kim: cherry-pick from linux-3.16.y to fix CVE-2017-16531]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I2413801c6cf5e9eeda0280ba859466d01f5fd9d9

5 years agodm: fix race between dm_get_from_kobject() and __dm_destroy() 78/179678/2
Hou Tao [Wed, 1 Nov 2017 07:42:36 +0000 (15:42 +0800)]
dm: fix race between dm_get_from_kobject() and __dm_destroy()

commit b9a41d21dceadf8104812626ef85dc56ee8a60ed upstream.

The following BUG_ON was hit when testing repeat creation and removal of
DM devices:

    kernel BUG at drivers/md/dm.c:2919!
    CPU: 7 PID: 750 Comm: systemd-udevd Not tainted 4.1.44
    Call Trace:
     [<ffffffff81649e8b>] dm_get_from_kobject+0x34/0x3a
     [<ffffffff81650ef1>] dm_attr_show+0x2b/0x5e
     [<ffffffff817b46d1>] ? mutex_lock+0x26/0x44
     [<ffffffff811df7f5>] sysfs_kf_seq_show+0x83/0xcf
     [<ffffffff811de257>] kernfs_seq_show+0x23/0x25
     [<ffffffff81199118>] seq_read+0x16f/0x325
     [<ffffffff811de994>] kernfs_fop_read+0x3a/0x13f
     [<ffffffff8117b625>] __vfs_read+0x26/0x9d
     [<ffffffff8130eb59>] ? security_file_permission+0x3c/0x44
     [<ffffffff8117bdb8>] ? rw_verify_area+0x83/0xd9
     [<ffffffff8117be9d>] vfs_read+0x8f/0xcf
     [<ffffffff81193e34>] ? __fdget_pos+0x12/0x41
     [<ffffffff8117c686>] SyS_read+0x4b/0x76
     [<ffffffff817b606e>] system_call_fastpath+0x12/0x71

The bug can be easily triggered, if an extra delay (e.g. 10ms) is added
between the test of DMF_FREEING & DMF_DELETING and dm_get() in
dm_get_from_kobject().

To fix it, we need to ensure the test of DMF_FREEING & DMF_DELETING and
dm_get() are done in an atomic way, so _minor_lock is used.

The other callers of dm_get() have also been checked to be OK: some
callers invoke dm_get() under _minor_lock, some callers invoke it under
_hash_lock, and dm_start_request() invoke it after increasing
md->open_count.

Signed-off-by: Hou Tao <houtao1@huawei.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
[sw0312.kim: cherry-pick from linux-3.16.y to fix CVE-2017-18203]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Ibb5d2d43f6ed7b98e4f73f99861bced6b06e0df7

5 years agocrypto: hmac - require that the underlying hash algorithm is unkeyed 77/179677/2
Eric Biggers [Wed, 29 Nov 2017 02:01:38 +0000 (18:01 -0800)]
crypto: hmac - require that the underlying hash algorithm is unkeyed

commit af3ff8045bbf3e32f1a448542e73abb4c8ceb6f1 upstream.

Because the HMAC template didn't check that its underlying hash
algorithm is unkeyed, trying to use "hmac(hmac(sha3-512-generic))"
through AF_ALG or through KEYCTL_DH_COMPUTE resulted in the inner HMAC
being used without having been keyed, resulting in sha3_update() being
called without sha3_init(), causing a stack buffer overflow.

This is a very old bug, but it seems to have only started causing real
problems when SHA-3 support was added (requires CONFIG_CRYPTO_SHA3)
because the innermost hash's state is ->import()ed from a zeroed buffer,
and it just so happens that other hash algorithms are fine with that,
but SHA-3 is not.  However, there could be arch or hardware-dependent
hash algorithms also affected; I couldn't test everything.

Fix the bug by introducing a function crypto_shash_alg_has_setkey()
which tests whether a shash algorithm is keyed.  Then update the HMAC
template to require that its underlying hash algorithm is unkeyed.

Here is a reproducer:

    #include <linux/if_alg.h>
    #include <sys/socket.h>

    int main()
    {
        int algfd;
        struct sockaddr_alg addr = {
            .salg_type = "hash",
            .salg_name = "hmac(hmac(sha3-512-generic))",
        };
        char key[4096] = { 0 };

        algfd = socket(AF_ALG, SOCK_SEQPACKET, 0);
        bind(algfd, (const struct sockaddr *)&addr, sizeof(addr));
        setsockopt(algfd, SOL_ALG, ALG_SET_KEY, key, sizeof(key));
    }

Here was the KASAN report from syzbot:

    BUG: KASAN: stack-out-of-bounds in memcpy include/linux/string.h:341  [inline]
    BUG: KASAN: stack-out-of-bounds in sha3_update+0xdf/0x2e0  crypto/sha3_generic.c:161
    Write of size 4096 at addr ffff8801cca07c40 by task syzkaller076574/3044

    CPU: 1 PID: 3044 Comm: syzkaller076574 Not tainted 4.14.0-mm1+ #25
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  Google 01/01/2011
    Call Trace:
      __dump_stack lib/dump_stack.c:17 [inline]
      dump_stack+0x194/0x257 lib/dump_stack.c:53
      print_address_description+0x73/0x250 mm/kasan/report.c:252
      kasan_report_error mm/kasan/report.c:351 [inline]
      kasan_report+0x25b/0x340 mm/kasan/report.c:409
      check_memory_region_inline mm/kasan/kasan.c:260 [inline]
      check_memory_region+0x137/0x190 mm/kasan/kasan.c:267
      memcpy+0x37/0x50 mm/kasan/kasan.c:303
      memcpy include/linux/string.h:341 [inline]
      sha3_update+0xdf/0x2e0 crypto/sha3_generic.c:161
      crypto_shash_update+0xcb/0x220 crypto/shash.c:109
      shash_finup_unaligned+0x2a/0x60 crypto/shash.c:151
      crypto_shash_finup+0xc4/0x120 crypto/shash.c:165
      hmac_finup+0x182/0x330 crypto/hmac.c:152
      crypto_shash_finup+0xc4/0x120 crypto/shash.c:165
      shash_digest_unaligned+0x9e/0xd0 crypto/shash.c:172
      crypto_shash_digest+0xc4/0x120 crypto/shash.c:186
      hmac_setkey+0x36a/0x690 crypto/hmac.c:66
      crypto_shash_setkey+0xad/0x190 crypto/shash.c:64
      shash_async_setkey+0x47/0x60 crypto/shash.c:207
      crypto_ahash_setkey+0xaf/0x180 crypto/ahash.c:200
      hash_setkey+0x40/0x90 crypto/algif_hash.c:446
      alg_setkey crypto/af_alg.c:221 [inline]
      alg_setsockopt+0x2a1/0x350 crypto/af_alg.c:254
      SYSC_setsockopt net/socket.c:1851 [inline]
      SyS_setsockopt+0x189/0x360 net/socket.c:1830
      entry_SYSCALL_64_fastpath+0x1f/0x96

Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
[sw0312.kim: cherry-pick from linux-3.16.y to fix CVE-2017-17806]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Icd8869c4d7ec660a97a83b5b957b72344e52b9c0

5 years agoudp: consistently apply ufo or fragmentation 76/179676/2
Willem de Bruijn [Thu, 10 Aug 2017 16:29:19 +0000 (12:29 -0400)]
udp: consistently apply ufo or fragmentation

commit 85f1bd9a7b5a79d5baa8bf44af19658f7bf77bfa upstream.

When iteratively building a UDP datagram with MSG_MORE and that
datagram exceeds MTU, consistently choose UFO or fragmentation.

Once skb_is_gso, always apply ufo. Conversely, once a datagram is
split across multiple skbs, do not consider ufo.

Sendpage already maintains the first invariant, only add the second.
IPv6 does not have a sendpage implementation to modify.

A gso skb must have a partial checksum, do not follow sk_no_check_tx
in udp_send_skb.

Found by syzkaller.

[gregkh - tweaks for 3.18 for ipv6, hopefully they are correct...]
[wt: s/skb_is_gso/skb_has_frags for 3.10]

Fixes: e89e9cf539a2 ("[IPv4/IPv6]: UFO Scatter-gather approach")
Reported-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
[sw0312.kim: cherry-pick from linux-3.10.y to fix CVE-2017-1000112]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I1c077ccd10cc5009cd098f7cd931a850717f3297

5 years agoudp: only allow UFO for packets from SOCK_DGRAM sockets 75/179675/2
Michal Kubeček [Mon, 2 Mar 2015 17:27:11 +0000 (18:27 +0100)]
udp: only allow UFO for packets from SOCK_DGRAM sockets

[ Upstream commit acf8dd0a9d0b9e4cdb597c2f74802f79c699e802 ]

If an over-MTU UDP datagram is sent through a SOCK_RAW socket to a
UFO-capable device, ip_ufo_append_data() sets skb->ip_summed to
CHECKSUM_PARTIAL unconditionally as all GSO code assumes transport layer
checksum is to be computed on segmentation. However, in this case,
skb->csum_start and skb->csum_offset are never set as raw socket
transmit path bypasses udp_send_skb() where they are usually set. As a
result, driver may access invalid memory when trying to calculate the
checksum and store the result (as observed in virtio_net driver).

Moreover, the very idea of modifying the userspace provided UDP header
is IMHO against raw socket semantics (I wasn't able to find a document
clearly stating this or the opposite, though). And while allowing
CHECKSUM_NONE in the UFO case would be more efficient, it would be a bit
too intrusive change just to handle a corner case like this. Therefore
disallowing UFO for packets from SOCK_DGRAM seems to be the best option.

Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[sw0312.kim: cherry-pick from linux-3.10.y to apply CVE patch]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Ie0707eb6445f53af54a750c667a3b9f2bb5efa77

5 years agokernel/signal.c: avoid undefined behaviour in kill_something_info 79/179679/2
zhongjiang [Mon, 10 Jul 2017 22:52:57 +0000 (15:52 -0700)]
kernel/signal.c: avoid undefined behaviour in kill_something_info

When running kill(72057458746458112, 0) in userspace I hit the following
issue.

  UBSAN: Undefined behaviour in kernel/signal.c:1462:11
  negation of -2147483648 cannot be represented in type 'int':
  CPU: 226 PID: 9849 Comm: test Tainted: G    B          ---- -------   3.10.0-327.53.58.70.x86_64_ubsan+ #116
  Hardware name: Huawei Technologies Co., Ltd. RH8100 V3/BC61PBIA, BIOS BLHSV028 11/11/2014
  Call Trace:
    dump_stack+0x19/0x1b
    ubsan_epilogue+0xd/0x50
    __ubsan_handle_negate_overflow+0x109/0x14e
    SYSC_kill+0x43e/0x4d0
    SyS_kill+0xe/0x10
    system_call_fastpath+0x16/0x1b

Add code to avoid the UBSAN detection.

[akpm@linux-foundation.org: tweak comment]
Link: http://lkml.kernel.org/r/1496670008-59084-1-git-send-email-zhongjiang@huawei.com
Signed-off-by: zhongjiang <zhongjiang@huawei.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Xishi Qiu <qiuxishi@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[sw0312.kim: cherry-pick from mainline to fix CVE-2018-10124]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Iaef10c2609a3e5bf23f3e4475bc24996884091a7

6 years agotcp: enable sockets to use MSG_FASTOPEN by default 83/178983/2 accepted/tizen/unified/20180517.062406 submit/tizen/20180517.023841
Yuchung Cheng [Thu, 31 Oct 2013 16:19:32 +0000 (09:19 -0700)]
tcp: enable sockets to use MSG_FASTOPEN by default

Applications have started to use Fast Open (e.g., Chrome browser has
such an optional flag) and the feature has gone through several
generations of kernels since 3.7 with many real network tests. It's
time to enable this flag by default for applications to test more
conveniently and extensively.

Signed-off-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Cheoleun Moon <chleun.moon@samsung.com>
[jh80.chung: cherry picked from commit 0d41cca490c2 from mainline]

Change-Id: I9dc9ce6e3e8de16bbefd5fd8c79ce9e4b39c4e81

6 years agoARM: tizen_tm1_defconfig: enable NETFILTER_XT_TARGET_LOG 23/176123/2 accepted/tizen/unified/20180419.080041 submit/tizen/20180418.005003
hyunuktak [Tue, 17 Apr 2018 01:16:25 +0000 (10:16 +0900)]
ARM: tizen_tm1_defconfig: enable NETFILTER_XT_TARGET_LOG

Enable NETFILTER_XT_TARGET_LOG for analysis of iptables log.
It is a iptables feature for security report on Tizen 5.0,
required from stc-manager.

Signed-off-by: hyunuktak <hyunuk.tak@samsung.com>
Change-Id: Ia31c1e9463f28b74a67bad7272e0fea08c88c28c

6 years agoARM: tizen_tm1_defconfig: enable AUDITSYSCALL 49/174749/1 accepted/tizen/unified/20180417.173217 submit/tizen/20180417.011414
Inki Dae [Wed, 4 Apr 2018 04:04:33 +0000 (13:04 +0900)]
ARM: tizen_tm1_defconfig: enable AUDITSYSCALL

Enabled AUDITSYSCALL for the use of audit subsystem.
A new security feature for Tizen 5.0 requires the subsystem
in default.

Change-Id: I4112a5ed4c6d232b77d0ba19f440cfdf4884249d
Signed-off-by: Inki Dae <inki.dae@samsung.com>
6 years agonetfilter: nfnetlink_queue: fix secctx memory leak 13/170913/1 accepted/tizen/unified/20180227.063123 submit/tizen/20180227.012056
Liping Zhang [Tue, 28 Mar 2017 14:59:25 +0000 (22:59 +0800)]
netfilter: nfnetlink_queue: fix secctx memory leak

We must call security_release_secctx to free the memory returned by
security_secid_to_secctx, otherwise memory may be leaked forever.

Fixes: ef493bd930ae ("netfilter: nfnetlink_queue: add security context information")
Signed-off-by: Liping Zhang <zlpnobody@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
[sw0312.kim: cherry-pick the commit 77c1c03c5b8 from mainline to fix already backported commit
 - the commit ef493bd930ae ("netfilter: nfnetlink_queue: add security context information") was backported for nether.service in tizen
 - change in net/netfilter/nfnetlink_queue.c is applied to net/netfilter/nfnetlink_queue_core.c]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Ifbc5f96bb6039503b7390864936fe6eda2e53acb

6 years agoproc, coredump: add CoreDumping flag to /proc/pid/status 48/168248/4 accepted/tizen/unified/20180130.144413 submit/tizen/20180130.013321
Roman Gushchin [Fri, 17 Nov 2017 23:26:45 +0000 (15:26 -0800)]
proc, coredump: add CoreDumping flag to /proc/pid/status

Right now there is no convenient way to check if a process is being
coredumped at the moment.

It might be necessary to recognize such state to prevent killing the
process and getting a broken coredump.  Writing a large core might take
significant time, and the process is unresponsive during it, so it might
be killed by timeout, if another process is monitoring and
killing/restarting hanging tasks.

We're getting a significant number of corrupted coredump files on
machines in our fleet, just because processes are being killed by
timeout in the middle of the core writing process.

We do have a process health check, and some agent is responsible for
restarting processes which are not responding for health check requests.
Writing a large coredump to the disk can easily exceed the reasonable
timeout (especially on an overloaded machine).

This flag will allow the agent to distinguish processes which are being
coredumped, extend the timeout for them, and let them produce a full
coredump file.

To provide an ability to detect if a process is in the state of being
coredumped, we can expose a boolean CoreDumping flag in
/proc/pid/status.

Example:
$ cat core.sh
  #!/bin/sh

  echo "|/usr/bin/sleep 10" > /proc/sys/kernel/core_pattern
  sleep 1000 &
  PID=$!

  cat /proc/$PID/status | grep CoreDumping
  kill -ABRT $PID
  sleep 1
  cat /proc/$PID/status | grep CoreDumping

$ ./core.sh
  CoreDumping: 0
  CoreDumping: 1

[guro@fb.com: document CoreDumping flag in /proc/<pid>/status]
Link: http://lkml.kernel.org/r/20170928135357.GA8470@castle.DHCP.thefacebook.com
Link: http://lkml.kernel.org/r/20170920230634.31572-1-guro@fb.com
Signed-off-by: Roman Gushchin <guro@fb.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Konstantin Khlebnikov <koct9i@gmail.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[inki.dae: backported from mainline - commit : c643401218be
  On Tizen, there is one issue that a process doing coredump can be killed.
  This patch allows a process to detect if given process is being dumped.
  With this, Tizen can exclude such process from 'kill list' so that
  coredump process can finish coredump work.]
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Change-Id: Idf983ff897d0cea308372b1cc401b2a39388799f

6 years agomisc: sdiodev: fix the wrong pointer type 93/165093/2 accepted/tizen/unified/20171227.062257 submit/tizen/20171227.024814
Jaehoon Chung [Tue, 26 Dec 2017 06:04:59 +0000 (15:04 +0900)]
misc: sdiodev: fix the wrong pointer type

Fix the wrong pointer type.

Change-Id: Id158d9e4128ea251a79644f62b4a6cf3146d162f
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
6 years agomisc: sim_slot: fix wrong fops callback 84/165084/1
Seung-Woo Kim [Tue, 26 Dec 2017 05:10:44 +0000 (14:10 +0900)]
misc: sim_slot: fix wrong fops callback

The write fops callback is assigned seq_lseek, but it is for llseek
callback. Also simslot_count never allows writing on it. Fix wrong
write fops callback to llseek callback.

Note: simslot_count is olny read by tel-plugin package and there is
no write or no lseek cases.

Change-Id: I0fe20e4caac899036bcdc5f01786bceaab059490
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agoARM: tizen_tm1_defconfig: disable FRAME_WARN config option 75/165075/1
Seung-Woo Kim [Tue, 26 Dec 2017 01:58:49 +0000 (10:58 +0900)]
ARM: tizen_tm1_defconfig: disable FRAME_WARN config option

The CONFIG_FRAME_WARN sets size of frame stack to warn and there
are some build warnins caused by too large frame size. Disable
the warnings with setting CONFIG_FRAME_WARN as 0.

NOTE: it only disables warning but it does not mean large frame
size is acceptable.

Change-Id: I42d4fb948110b22495f8b57c391456a0bddc7db2
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agomisc: sdio: remove build warnings 71/165071/1
Seung-Woo Kim [Tue, 26 Dec 2017 01:51:53 +0000 (10:51 +0900)]
misc: sdio: remove build warnings

Remove build warnings.

Change-Id: I0b4506532ecce3e92d559f67903acf9cd250bc6e
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agommc: core: remove build warning caused by sprd bsp 74/164974/1
Seung-Woo Kim [Fri, 22 Dec 2017 06:37:02 +0000 (15:37 +0900)]
mmc: core: remove build warning caused by sprd bsp

During sprd bsp, not used function is added and it causes unused
function build warning. Remove the build warning by removing the
function.

Change-Id: Id3cea904edca1c41413c28f0c831617b5385af25
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agommc: sprd : remove build warnings 73/164973/1
Seung-Woo Kim [Fri, 22 Dec 2017 06:35:33 +0000 (15:35 +0900)]
mmc: sprd : remove build warnings

Remove build warnings including unused-variable, unused-label and
int-conversion.

Change-Id: I171d21f8fada70b27291730444ae82a5883fff0c
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agomisc: mdbg: remove build warnings 56/164956/1
Seung-Woo Kim [Fri, 22 Dec 2017 04:37:18 +0000 (13:37 +0900)]
misc: mdbg: remove build warnings

Remove build warnings in sprd mdbg misc driver.

Change-Id: Ic2a06079da18f04252eeea8005e2ec6088de5c6a
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agomisc: sprd: remove build warnings 55/164955/1
Seung-Woo Kim [Fri, 22 Dec 2017 04:36:40 +0000 (13:36 +0900)]
misc: sprd: remove build warnings

Remove build warnings in sprd misc drivers.

Change-Id: I6d307506a956cbae56841f50a39f8fc59bc9c21e
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agoregulator: core: remove build warning caused by sprd bsp 54/164954/1
Seung-Woo Kim [Fri, 22 Dec 2017 04:34:47 +0000 (13:34 +0900)]
regulator: core: remove build warning caused by sprd bsp

From sprd bsp, regulator_init_complete() is fixed not to be called
and it causes unused function build waring. Remove the build warning.

Change-Id: I63d26fbe9b22d4bb4467f859d2ad762998be0931
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agoion/sprd: remove build warning 53/164953/1
Seung-Woo Kim [Fri, 22 Dec 2017 04:33:50 +0000 (13:33 +0900)]
ion/sprd: remove build warning

Remove unused variable build warning.

Change-Id: Id630226984ac3eb379a973be5a42448f2da90cf8
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agobase: sync: Include seq_file.h in sync.h 48/164848/1
Jonathan Hamilton [Fri, 8 Feb 2013 21:05:38 +0000 (13:05 -0800)]
base: sync: Include seq_file.h in sync.h

sync.h uses struct seq_file in some function table prototypes. This
causes compile failures when including the header in files that do not
otherwise include seq_file.h

Signed-off-by: Jonathan Hamilton <jonathan.hamilton@imgtec.com>
[sw0312.kim: cherry-pick the commit d37806bb7617 from https://android.googlesource.com/kernel/common to fix build warning]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I42183b09a64e26d57c5f176757f691378ffd578e

6 years agothermal: sprd: remove build warnings 14/164814/1
Seung-Woo Kim [Thu, 21 Dec 2017 06:32:41 +0000 (15:32 +0900)]
thermal: sprd: remove build warnings

Remove build warnings including unused-function, unused-variable,
incompatible-pointer-types and int-conversion.

Change-Id: Iae52665eb828e1b958c0a34970a2b3152b0699eb
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agoserial: sprd: remove build warning 97/164797/1
Seung-Woo Kim [Thu, 21 Dec 2017 05:10:25 +0000 (14:10 +0900)]
serial: sprd: remove build warning

Remove build warnings including unused variable, unused function
and implicit pointer use from integer.

Change-Id: I9d2326cedfaeadd4de23d6fcd7a4d6d133ffdaac
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agobacklight: ktd3102: remove build warnings 84/164784/1
Seung-Woo Kim [Thu, 21 Dec 2017 04:53:17 +0000 (13:53 +0900)]
backlight: ktd3102: remove build warnings

Remove build warnings caused from unused variable and non declared
struct.

Change-Id: I28b7cbd9cf166122583ce98f27769851bb85c12b
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agomedia: sprd_isp: remove build warnings 94/164694/3
Seung-Woo Kim [Wed, 20 Dec 2017 10:30:40 +0000 (19:30 +0900)]
media: sprd_isp: remove build warnings

Remove build warnings including wrong print format, unused function,
and unused variable.

Change-Id: I21b97f3b98c9039126038c075ddb36ceaea09200
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agoplatform/sprd: remove build warnings 86/164686/3
Seung-Woo Kim [Wed, 20 Dec 2017 09:55:13 +0000 (18:55 +0900)]
platform/sprd: remove build warnings

Remove build warnings from sprd platform drivers.

Change-Id: Ifd838abc5d012a908e94fdeec0ec320667a7e9d5
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agomedia: sprd_dcam: remove build warnings 85/164685/3
Seung-Woo Kim [Wed, 20 Dec 2017 09:54:13 +0000 (18:54 +0900)]
media: sprd_dcam: remove build warnings

Remove build warnings.

Change-Id: Iecca7b0767d47abb01e444b9a34d861917e5e149
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agofbdev: sprd: fix wrong sscanf() parameters 23/164623/3
Seung-Woo Kim [Wed, 20 Dec 2017 05:03:49 +0000 (14:03 +0900)]
fbdev: sprd: fix wrong sscanf() parameters

There were several wrong sscanf() parameter usages. Fix the wrong
parameters.

Note: "%s" format for sscanf() of kernel is required char * but it
was assigned char **, but strangely, both cases are fine on runtime.

Change-Id: I9c77a71f7c26fe25935c2633a5806291c537d181
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agofbdev: sprd: remove build warnings 22/164622/3
Seung-Woo Kim [Wed, 20 Dec 2017 05:02:46 +0000 (14:02 +0900)]
fbdev: sprd: remove build warnings

Remove build warnings.

Change-Id: I6755843fe76058c42811fbbbf86d38e8dae9aaf3
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agomedia: sprd_sensor: fix wrong parameter on device_destroy() 89/164589/3
Seung-Woo Kim [Wed, 20 Dec 2017 01:23:03 +0000 (10:23 +0900)]
media: sprd_sensor: fix wrong parameter on device_destroy()

There are wrong parameter usages for device_destroy() in error path. Fix
the wrong parameter with proper dev->devt element.

Change-Id: I4df6a5a1fefe9cd6884b9b1ef220648e1176587e
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agomedia: sprd_sensor: remove build warnings 88/164588/3
Seung-Woo Kim [Wed, 20 Dec 2017 01:21:55 +0000 (10:21 +0900)]
media: sprd_sensor: remove build warnings

Remoev build warnings.

Change-Id: I7ed9a94c98f99a82349cad38263c56375fbc1b44
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agoiommu: sprd: remove build warnings 00/164500/1
Seung-Woo Kim [Tue, 19 Dec 2017 09:25:04 +0000 (18:25 +0900)]
iommu: sprd: remove build warnings

Remove build warnings including wrong casting, shift warning and
unused variable.

Change-Id: I8c9517725db3c59e0a3f5380543ae0aca93fda57
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agogpio/sprd-eic: remove build warning 90/164390/1
Seung-Woo Kim [Tue, 19 Dec 2017 04:04:47 +0000 (13:04 +0900)]
gpio/sprd-eic: remove build warning

Remove build warning because of no return check.

Change-Id: Idd46626118be4c76a22ecdd3cdb69e40cb549242
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agosprd/sipc: fix wrong double pointer usage 73/164373/1
Seung-Woo Kim [Tue, 19 Dec 2017 01:54:18 +0000 (10:54 +0900)]
sprd/sipc: fix wrong double pointer usage

There is wrong converting double pointer to pointer. Fix the wrong
double pointer usage.

NOTE: sipc is built-in module, so the remove callback is not really
called and this does not really change operation flow.

Change-Id: I5f035c9e12003fdd1d0799f712fd6b450e101124
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agosprd/sipc: remove build warnings 72/164372/1
Seung-Woo Kim [Tue, 19 Dec 2017 01:51:39 +0000 (10:51 +0900)]
sprd/sipc: remove build warnings

Remove build warnings including wrong printing format and wrong cast.

Change-Id: If3ba9d58eab7bfa6a269934aedf1ba700692aafd
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agosprd/iq: remove build warning 88/164288/1
Seung-Woo Kim [Mon, 18 Dec 2017 09:27:44 +0000 (18:27 +0900)]
sprd/iq: remove build warning

Remove unused variable build warning.

Change-Id: I29c0b76b872c3f075c0493231aa6ad03920126cc
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agopower: fuel_gauge: sprd2713: remove build warning 87/164287/1
Seung-Woo Kim [Mon, 18 Dec 2017 09:26:18 +0000 (18:26 +0900)]
power: fuel_gauge: sprd2713: remove build warning

Remove wrong print format build warning.

Change-Id: I88964cebce54476dfc2baaa4f41085ae4fc90a6f
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agoARM: mach-sc: remove cast to pointer from integer of different size 86/164286/1
Seung-Woo Kim [Mon, 18 Dec 2017 09:24:04 +0000 (18:24 +0900)]
ARM: mach-sc: remove cast to pointer from integer of different size

Remove build warnings from cast to pointer from integer of different size.

Change-Id: I8ac8ec85f07df647b850a12e0bf54e81e6fe66ec
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agohwspinlock/sprd: remove build warnings 85/164285/1
Seung-Woo Kim [Mon, 18 Dec 2017 09:22:19 +0000 (18:22 +0900)]
hwspinlock/sprd: remove build warnings

Remove unused functions build warnings.

Change-Id: I9181643757dc7a562c81a3ea7c204e5c06df8202
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agodrm/sprd: remove build warnings 84/164284/1
Seung-Woo Kim [Mon, 18 Dec 2017 09:19:41 +0000 (18:19 +0900)]
drm/sprd: remove build warnings

Remove build warnings including unsed variables, unused functions,
and wrong print formats.

Change-Id: I8483b364d26e959b0736c0723849df078c06c7a5
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agosmack: Fix gcc warning from unused smack_syslog_lock mutex in smackfs.c 90/164090/1 accepted/tizen_4.0_unified accepted/tizen/4.0/unified/20171218.072033 accepted/tizen/unified/20171218.072335 submit/tizen/20171218.021305 submit/tizen_4.0/20171218.021435 tizen_4.0.IoT.p2_release
Paul Gortmaker [Mon, 23 Mar 2015 18:03:17 +0000 (14:03 -0400)]
smack: Fix gcc warning from unused smack_syslog_lock mutex in smackfs.c

In commit 00f84f3f2e9d088f06722f4351d67f5f577abe22 ("Smack: Make the
syslog control configurable") this mutex was added, but the rest of
the final commit never actually made use of it, resulting in:

 In file included from include/linux/mutex.h:29:0,
                  from include/linux/notifier.h:13,
                  from include/linux/memory_hotplug.h:6,
                  from include/linux/mmzone.h:821,
                  from include/linux/gfp.h:5,
                  from include/linux/slab.h:14,
                  from include/linux/security.h:27,
                  from security/smack/smackfs.c:21:
 security/smack/smackfs.c:63:21: warning: ‘smack_syslog_lock’ defined but not used [-Wunused-variable]
  static DEFINE_MUTEX(smack_syslog_lock);
                      ^

A git grep shows no other instances/references to smack_syslog_lock.
Delete it, assuming that the mutex addition was just a leftover from
an earlier work in progress version of the change.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
[sw0312.kim: backport from mainline commit f43b65bad6d5 to remove build warning cuased by backported commit]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Id1a38438a4f11f0cf4dff7cbf94e567a90de88fe

6 years agoSmack: Make the syslog control configurable 89/164089/1
Casey Schaufler [Mon, 23 Dec 2013 19:07:10 +0000 (11:07 -0800)]
Smack: Make the syslog control configurable

The syslog control requires that the calling proccess
have the floor ("_") Smack label. Tizen does not run any
processes except for kernel helpers with the floor label.
This changes allows the admin to configure a specific
label for syslog. The default value is the star ("*")
label, effectively removing the restriction. The value
can be set using smackfs/syslog for anyone who wants
a more restrictive behavior.

Targeted for git://git.gitorious.org/smack-next/kernel.git

Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
[sw0312.kim: backport from mainline commit 00f84f3f2e9d to support non-root user dlog]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I030b6a271020c1ff9aa79538afb753fed3d7289e

6 years agoinput: headset-sprd: Fixed build warnings 89/160989/2 accepted/tizen/unified/20171130.063259 submit/tizen/20171129.051842
Jaechul Lee [Tue, 21 Nov 2017 04:48:05 +0000 (13:48 +0900)]
input: headset-sprd: Fixed build warnings

Fix build warnings unused-variable, declaration-after-statement

Change-Id: I2fd8b90ea483fbbe39d568d03b38b9fc7f1b349d
Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
6 years agoperf: Fix arch_perf_out_copy_user default 91/160791/5
Peter Zijlstra [Wed, 30 Oct 2013 20:16:22 +0000 (21:16 +0100)]
perf: Fix arch_perf_out_copy_user default

The arch_perf_output_copy_user() default of
__copy_from_user_inatomic() returns bytes not copied, while all other
argument functions given DEFINE_OUTPUT_COPY() return bytes copied.

Since copy_from_user_nmi() is the odd duck out by returning bytes
copied where all other *copy_{to,from}* functions return bytes not
copied, change it over and ammend DEFINE_OUTPUT_COPY() to expect bytes
not copied.

Oddly enough DEFINE_OUTPUT_COPY() already returned bytes not copied
while expecting its worker functions to return bytes copied.

Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Acked-by: will.deacon@arm.com
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Link: http://lkml.kernel.org/r/20131030201622.GR16117@laptop.programming.kicks-ass.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
[inki.dae: backport mainline commit 0a196848ca36 to show proper perf result graph]
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Change-Id: Icde4bc44cb0dc6c3ddd88398a33163e5689ed82a

6 years agoperf: Improve the perf_sample_data struct layout 90/160790/5
Peter Zijlstra [Wed, 24 Sep 2014 11:48:42 +0000 (13:48 +0200)]
perf: Improve the perf_sample_data struct layout

This patch reorders fields in the perf_sample_data struct in order to
minimize the number of cachelines touched in perf_sample_data_init().
It also removes some intializations which are redundant with the code
in kernel/events/core.c

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1411559322-16548-7-git-send-email-eranian@google.com
Cc: cebbert.lkml@gmail.com
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: jolsa@redhat.com
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
[inki.dae: backport mainline commit 2565711fb7d7 to show proper perf result graph]
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Change-Id: I92db818e36740e3601da3a5a00fc5973840ef8c2

6 years agoperf: Add ability to sample machine state on interrupt 89/160789/5
Stephane Eranian [Wed, 24 Sep 2014 11:48:37 +0000 (13:48 +0200)]
perf: Add ability to sample machine state on interrupt

Enable capture of interrupted machine state for each sample.

Registers to sample are passed per event in the sample_regs_intr bitmask.

To sample interrupt machine state, the PERF_SAMPLE_INTR_REGS must be passed in
sample_type.

The list of available registers is arch dependent and provided by asm/perf_regs.h

Registers are laid out as u64 in the order of the bit order of sample_intr_regs.

This patch also adds a new ABI version PERF_ATTR_SIZE_VER4 because we extend
the perf_event_attr struct with a new u64 field.

Reviewed-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: cebbert.lkml@gmail.com
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-api@vger.kernel.org
Link: http://lkml.kernel.org/r/1411559322-16548-2-git-send-email-eranian@google.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
[inki.dae: backport mainline commit 60e2364e60e8 to show proper perf result graph]
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Change-Id: I3127f0a78ed6d0f78b0d2db73a1c5b114322c369

6 years agoperf: Document the new transaction sample type 88/160788/5
Vince Weaver [Fri, 13 Dec 2013 20:52:25 +0000 (15:52 -0500)]
perf: Document the new transaction sample type

Commit fdfbbd07e91f8fe3871 ("perf: Add generic transaction flags")
added support for PERF_SAMPLE_TRANSACTION but forgot to add documentation
for the sample type to include/uapi/linux/perf_event.h

Signed-off-by: Vince Weaver <vincent.weaver@maine.edu>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Cc: Andi Kleen <ak@linux.intel.com>
Link: http://lkml.kernel.org/r/alpine.DEB.2.02.1312131548450.10372@pianoman.cluster.toy
Signed-off-by: Ingo Molnar <mingo@kernel.org>
[inki.dae: backport mainline commit 189b84fb5449 to show proper perf result graph]
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Change-Id: I5910990525a9bc7014c9b5c3e7002e62bc6e51c5

6 years agoperf: Add generic transaction flags 87/160787/5
Andi Kleen [Fri, 20 Sep 2013 14:40:39 +0000 (07:40 -0700)]
perf: Add generic transaction flags

Add a generic qualifier for transaction events, as a new sample
type that returns a flag word. This is particularly useful
for qualifying aborts: to distinguish aborts which happen
due to asynchronous events (like conflicts caused by another
CPU) versus instructions that lead to an abort.

The tuning strategies are very different for those cases,
so it's important to distinguish them easily and early.

Since it's inconvenient and inflexible to filter for this
in the kernel we report all the events out and allow
some post processing in user space.

The flags are based on the Intel TSX events, but should be fairly
generic and mostly applicable to other HTM architectures too. In addition
to various flag words there's also reserved space to report an
program supplied abort code. For TSX this is used to distinguish specific
classes of aborts, like a lock busy abort when doing lock elision.

Flags:

Elision and generic transactions     (ELISION vs TRANSACTION)
(HLE vs RTM on TSX; IBM etc.  would likely only use TRANSACTION)
Aborts caused by current thread vs aborts caused by others (SYNC vs ASYNC)
Retryable transaction    (RETRY)
Conflicts with other threads    (CONFLICT)
Transaction write capacity overflow    (CAPACITY WRITE)
Transaction read capacity overflow    (CAPACITY READ)

Transactions implicitely aborted can also return an abort code.
This can be used to signal specific events to the profiler. A common
case is abort on lock busy in a RTM eliding library (code 0xff)
To handle this case we include the TSX abort code

Common example aborts in TSX would be:

- Data conflict with another thread on memory read.
                                      Flags: TRANSACTION|ASYNC|CONFLICT
- executing a WRMSR in a transaction. Flags: TRANSACTION|SYNC
- HLE transaction in user space is too large
                                      Flags: ELISION|SYNC|CAPACITY-WRITE

The only flag that is somewhat TSX specific is ELISION.

This adds the perf core glue needed for reporting the new flag word out.

v2: Add MEM/MISC
v3: Move transaction to the end
v4: Separate capacity-read/write and remove misc
v5: Remove _SAMPLE. Move abort flags to 32bit. Rename
    transaction to txn
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1379688044-14173-2-git-send-email-andi@firstfloor.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
[inki.dae: backport mainline commit fdfbbd07e91f to show proper perf result graph]
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Change-Id: I8a6349c860fa7a4d6e085e52452e44f729042aba

6 years agoperf: make events stream always parsable 86/160786/4
Adrian Hunter [Tue, 27 Aug 2013 08:23:07 +0000 (11:23 +0300)]
perf: make events stream always parsable

The event stream is not always parsable because the format of a sample
is dependent on the sample_type of the selected event.  When there is
more than one selected event and the sample_types are not the same then
parsing becomes problematic.  A sample can be matched to its selected
event using the ID that is allocated when the event is opened.
Unfortunately, to get the ID from the sample means first parsing it.

This patch adds a new sample format bit PERF_SAMPLE_IDENTIFER that puts
the ID at a fixed position so that the ID can be retrieved without
parsing the sample.  For sample events, that is the first position
immediately after the header.  For non-sample events, that is the last
position.

In this respect parsing samples requires that the sample_type and ID
values are recorded.  For example, perf tools records struct
perf_event_attr and the IDs within the perf.data file.  Those must be
read first before it is possible to parse samples found later in the
perf.data file.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Stephane Eranian <eranian@google.com>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1377591794-30553-6-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
[inki.dae: backport mainline commit ff3d527cebc1 to show proper perf result graph]
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Change-Id: I073f77c98152300fe594233de4f0ce998d511890

6 years agoperf: Fix event->ctx locking 93/160893/1
Peter Zijlstra [Fri, 23 Jan 2015 11:24:14 +0000 (12:24 +0100)]
perf: Fix event->ctx locking

commit f63a8daa5812afef4f06c962351687e1ff9ccb2b upstream.

There have been a few reported issues wrt. the lack of locking around
changing event->ctx. This patch tries to address those.

It avoids the whole rwsem thing; and while it appears to work, please
give it some thought in review.

What I did fail at is sensible runtime checks on the use of
event->ctx, the RCU use makes it very hard.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/20150123125834.209535886@infradead.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
[sw0312.kim: backport the commit 18163dd15627 from linux-3.16.y to fix CVE-2016-6787 and CVE-2016-6788]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I058da6e62db2ce7166aad2b87a60929d6d56b4d3

6 years agox86/ldt: Make modify_ldt synchronous 92/160892/1
Andy Lutomirski [Thu, 30 Jul 2015 21:31:32 +0000 (14:31 -0700)]
x86/ldt: Make modify_ldt synchronous

commit 37868fe113ff2ba814b3b4eb12df214df555f8dc upstream.

modify_ldt() has questionable locking and does not synchronize
threads.  Improve it: redesign the locking and synchronize all
threads' LDTs using an IPI on all modifications.

This will dramatically slow down modify_ldt in multithreaded
programs, but there shouldn't be any multithreaded programs that
care about modify_ldt's performance in the first place.

This fixes some fallout from the CVE-2015-5157 fixes.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Reviewed-by: Borislav Petkov <bp@suse.de>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sasha Levin <sasha.levin@oracle.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: security@kernel.org <security@kernel.org>
Cc: xen-devel <xen-devel@lists.xen.org>
Link: http://lkml.kernel.org/r/4c6978476782160600471bd865b318db34c7b628.1438291540.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
[ luis: backported to 3.16:
  - dropped changes to comments in switch_mm()
  - included asm/mmu_context.h in perf_event.c
  - adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
[sw0312.kim: backport the commit b29f804421c4 from linux-3.16.y to fix CVE-2015-5157]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I189a166480ae8b758e9b992c87a1e7ff7fb8c2ad

6 years agomedia: radio: sprd: Fixed build warnings 44/160744/1
Jaechul Lee [Mon, 20 Nov 2017 01:08:19 +0000 (10:08 +0900)]
media: radio: sprd: Fixed build warnings

Fixed build warnings Wunused-variable

Change-Id: I297d9fdde5168e7851b77b1830e64b1ebabcdaf7
Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
6 years agomisc: clk_mon: Remove some of build warnings 53/159753/4 accepted/tizen/unified/20171114.062805 submit/tizen/20171113.235549
Wook Song [Mon, 13 Nov 2017 04:05:07 +0000 (13:05 +0900)]
misc: clk_mon: Remove some of build warnings

This patch removes build warnings caused by differences between
expected function argument type and actual passed function argument and
the build warning caused by a variable declaration in the middle of
code. Note that the build warning introduced by -Wframe-larger-than
remains.

Change-Id: Ia59d6c978a3692757833778bdc65a225c864713e
Signed-off-by: Wook Song <wook16.song@samsung.com>
6 years agoleds: sm5701: Remove build warnings 52/159752/3
Wook Song [Mon, 13 Nov 2017 02:38:06 +0000 (11:38 +0900)]
leds: sm5701: Remove build warnings

This patch remove build warnings caused by wrong usage of the
container_of macro.

Change-Id: I76d9e74300a85fd864b2e93caf7429588df90d04
Signed-off-by: Wook Song <wook16.song@samsung.com>
6 years agoASoC: sprd: Remove build warnings 67/159767/1
Jaechul Lee [Mon, 13 Nov 2017 02:28:51 +0000 (11:28 +0900)]
ASoC: sprd: Remove build warnings

Add __maybe_unused for fixing Wunused-function.

Change-Id: I90c9bd1b0e07fcd5be498acae051afc02dff4d13
Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
6 years agoALSA: drivers: Remove build warnings 60/159760/2
Jaechul Lee [Mon, 13 Nov 2017 02:25:49 +0000 (11:25 +0900)]
ALSA: drivers: Remove build warnings

Remove build warnings like Wunused-variable, Wdiscarded-qualifiers.

Change-Id: I90c58e93f571af03aba322d989691bf2872c784f
Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
6 years agokconfig: Fix warning "‘jump’ may be used uninitialized" 41/159741/1
Peter Kümmel [Tue, 4 Nov 2014 11:01:59 +0000 (12:01 +0100)]
kconfig: Fix warning "‘jump’ may be used uninitialized"

Warning:
In file included from scripts/kconfig/zconf.tab.c:2537:0:
scripts/kconfig/menu.c: In function ‘get_symbol_str’:
scripts/kconfig/menu.c:590:18: warning: ‘jump’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     jump->offset = strlen(r->s);

Simplifies the test logic because (head && local) means (jump != 0)
and makes GCC happy when checking if the jump pointer was initialized.

Signed-off-by: Peter Kümmel <syntheticpp@gmx.net>
Signed-off-by: Michal Marek <mmarek@suse.cz>
[sw0312.kim: cherry-pick from mainline commit 2d5603060967 to fix build warning]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I8b834f68f6e4d1637e001991feb6708e85d4ea00

6 years agoInput: keyboard: tc350-touchkey: Remove a build warning 48/159648/1 accepted/tizen/unified/20171113.092516 submit/tizen/20171113.013653
Wook Song [Fri, 10 Nov 2017 08:25:30 +0000 (17:25 +0900)]
Input: keyboard: tc350-touchkey: Remove a build warning

This patch removes a build warning caused by a unused variable.

Change-Id: Ib89f0b36a5e443466698d6fa45939ef716dab393
Signed-off-by: Wook Song <wook16.song@samsung.com>
6 years agoInput: keyboard: sc_keypad: Remove build warnings 47/159647/1
Wook Song [Fri, 10 Nov 2017 07:59:47 +0000 (16:59 +0900)]
Input: keyboard: sc_keypad: Remove build warnings

This patch removes build warnings caused by differences between expected
function argument type and actual passed function argument type. In
addition, several build warnings introduced by unused
variables/functions and type conversions without cast are removed.

Change-Id: I612420f1cb900ba79c58d2a5980e49b80e9a0386
Signed-off-by: Wook Song <wook16.song@samsung.com>
6 years agoInput: keyboard: sprd_eic: Remove build warnings 28/159628/3
Wook Song [Fri, 10 Nov 2017 07:25:05 +0000 (16:25 +0900)]
Input: keyboard: sprd_eic: Remove build warnings

This patch removes build warnings caused by passing wrong pointer type
as a function argument type. The build warnings caused by unused
variables/functions, and variable declarations in the middle of code are
also removed.

Change-Id: I7cadc6ed8cd8763e5773652e9f4d8cb0e7f46cdb
Signed-off-by: Wook Song <wook16.song@samsung.com>
6 years agousb: dwc_otg: Remove build warnings 87/159587/2
Wook Song [Fri, 10 Nov 2017 02:22:55 +0000 (11:22 +0900)]
usb: dwc_otg: Remove build warnings

This patch removes build warnings caused by type conversions without
cast, unused variables/functions, wrong printk format strings, 'return'
with a value in function returning void, and ignorance of return value
of several functions.

Change-Id: Icbb1b40984f6ad3f78a3a921320fdf7660e4f7d2
Signed-off-by: Wook Song <wook16.song@samsung.com>
6 years agomfd: sm5701: Remove build warnings 75/159575/3
Wook Song [Fri, 10 Nov 2017 00:38:40 +0000 (09:38 +0900)]
mfd: sm5701: Remove build warnings

This patch removes build warnings caused by non-existent function
argument type, unused function, and wrong printk format strings.

Change-Id: I7ceb213b3326e261e2a7ddeb4fc2e78d1d46db2a
Signed-off-by: Wook Song <wook16.song@samsung.com>
6 years agomfd: sm5504: Remove build warnings 74/159574/2
Wook Song [Fri, 10 Nov 2017 00:37:02 +0000 (09:37 +0900)]
mfd: sm5504: Remove build warnings

This patch removes build warnings caused by unused varibles and
functions.

Change-Id: I925a2bd95c204267106372e35080abfe0519ee44
Signed-off-by: Wook Song <wook16.song@samsung.com>
6 years agozram: Resolve build warnings due to redefined macros 73/159573/2
Wook Song [Thu, 9 Nov 2017 11:26:12 +0000 (20:26 +0900)]
zram: Resolve build warnings due to redefined macros

This patch removes build warnings due to redefined macros.

Change-Id: I9c7e50d5fd9bdc6de4415c4893c8041c66420147
Signed-off-by: Wook Song <wook16.song@samsung.com>
6 years agoPM / sprd: Remove build warnings 91/159491/3
Wook Song [Thu, 9 Nov 2017 07:14:35 +0000 (16:14 +0900)]
PM / sprd: Remove build warnings

This patch removes build warnings caused by making pointers from integer
without casts, unexpected types of function arguments, unused
variables/functions, using variables without initialization, using wrong
printk format strings, and -Wreturn-type.

Change-Id: Ic08fc5384235643ebeae2bf13c9609013c781563
Signed-off-by: Wook Song <wook16.song@samsung.com>
6 years agoASoC: sprd: Remove build warnings 60/159460/2
Jaechul Lee [Thu, 9 Nov 2017 05:30:52 +0000 (14:30 +0900)]
ASoC: sprd: Remove build warnings

Fix build warnings in sprd such as redefine, -Wunused-variable,
Wparentheses, Wformat-extra-args

Change-Id: I6397abc3f9716235e87896d024f7d3fc09f7c77e
Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
6 years agocpufreq: platform: sprd: Remove build warnings 47/159447/3
Wook Song [Thu, 9 Nov 2017 03:14:47 +0000 (12:14 +0900)]
cpufreq: platform: sprd: Remove build warnings

This patch removes build warnings caused by unused variables/functions,
making pointer from integer without cast, and unexpected type of a
function argument.

Change-Id: I33486abad8bd8760b1cffc96a06bc0baa20fafb6
Signed-off-by: Wook Song <wook16.song@samsung.com>
6 years agoPM / load_analyzer: Remove build warnings 77/159177/1
Wook Song [Tue, 7 Nov 2017 09:19:33 +0000 (18:19 +0900)]
PM / load_analyzer: Remove build warnings

This patch removes build warnings caused by redefined macros and unused
variables.

Change-Id: I593b5b0e010b4fdf03d46dc8b5a74d41c5787b32
Signed-off-by: Wook Song <wook16.song@samsung.com>
6 years agocpufreq: sprd: Remove build warnings 94/159094/2
Wook Song [Tue, 7 Nov 2017 02:49:04 +0000 (11:49 +0900)]
cpufreq: sprd: Remove build warnings

This patch removes build warnings introduced by unused variables, unused
functions, and -Wincompatible-pointer-types.

Change-Id: Icfc07589b52bb4d51af7e27d87e97ace1568dcd4
Signed-off-by: Wook Song <wook16.song@samsung.com>
6 years agoautotst: remove build warnings 70/158670/1 accepted/tizen/unified/20171106.073145 submit/tizen/20171106.023205
Seung-Woo Kim [Thu, 2 Nov 2017 09:56:30 +0000 (18:56 +0900)]
autotst: remove build warnings

Remove build warnings including unused variable, redefined macro and
assignment from inger without a cast.

Change-Id: I7faf4ef345244be3f7aa626163de079fb0b2a840
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agowlan: sc2331: fix build warnings 67/158667/1
Seung-Woo Kim [Thu, 2 Nov 2017 09:48:08 +0000 (18:48 +0900)]
wlan: sc2331: fix build warnings

Fix build warnings.

Change-Id: I0f16258795e30eaa4818127f61229d90f717f5af
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agousb: gadget: vserial: remove unused variable build warnings 72/158572/1
Seung-Woo Kim [Thu, 2 Nov 2017 02:06:57 +0000 (11:06 +0900)]
usb: gadget: vserial: remove unused variable build warnings

There are build warnings about unused variable because of debug
log print function. Remove the build warnings with __maybe_unused
macro.

Change-Id: I3b0a61beb388876efab82c7fdc8ee196946ad08f
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agousb: gadget: slp: remove build warnings 71/158571/1
Seung-Woo Kim [Thu, 2 Nov 2017 01:56:26 +0000 (10:56 +0900)]
usb: gadget: slp: remove build warnings

There are build warnings about incompatible pointer type and unused
function. Remove the build warnings.

Change-Id: I666cf0a172f9aa66a6dfbb06587bc6a0501cbdb5
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agobattery: fix build warnings 29/158529/1
Seung-Woo Kim [Wed, 1 Nov 2017 12:38:32 +0000 (21:38 +0900)]
battery: fix build warnings

Fix build warnings in product battery driver.

Change-Id: I532f2ee3d8401823f0d5e4c029c4c73c3d83793b
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 years agoARM: lib: fix build warnings in ksm optimized memcmp 24/158524/1
Seung-Woo Kim [Wed, 1 Nov 2017 11:43:14 +0000 (20:43 +0900)]
ARM: lib: fix build warnings in ksm optimized memcmp

With linux/limkage.h header, there are macro redefined build
warnings. Fix the build warnings by removing the header.

Change-Id: Ia9904af0f7db840b2517b8da8f25ba346835ea96
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>