Commit Graph

800740 Commits

Author SHA1 Message Date
Linus Torvalds
44fc087c85 cert host tools: Stop complaining about deprecated OpenSSL functions
OpenSSL 3.0 deprecated the OpenSSL's ENGINE API.  That is as may be, but
the kernel build host tools still use it.  Disable the warning about
deprecated declarations until somebody who cares fixes it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Change-Id: I655a75665920983abc9c3b0d73abfcb34f41b610
2023-01-08 11:00:43 +02:00
Jaewon Kim
61649657a1 page_alloc: consider highatomic reserve in watermark fast
zone_watermark_fast was introduced by commit 48ee5f3696 ("mm,
page_alloc: shortcut watermark checks for order-0 pages").  The commit
simply checks if free pages is bigger than watermark without additional
calculation such like reducing watermark.

It considered free cma pages but it did not consider highatomic reserved.
This may incur exhaustion of free pages except high order atomic free
pages.

Assume that reserved_highatomic pageblock is bigger than watermark min,
and there are only few free pages except high order atomic free.  Because
zone_watermark_fast passes the allocation without considering high order
atomic free, normal reclaimable allocation like GFP_HIGHUSER will consume
all the free pages.  Then finally order-0 atomic allocation may fail on
allocation.

This means watermark min is not protected against non-atomic allocation.
The order-0 atomic allocation with ALLOC_HARDER unwantedly can be failed.
Additionally the __GFP_MEMALLOC allocation with ALLOC_NO_WATERMARKS also
can be failed.

To avoid the problem, zone_watermark_fast should consider highatomic
reserve.  If the actual size of high atomic free is counted accurately
like cma free, we may use it.  On this patch just use
nr_reserved_highatomic.  Additionally introduce
__zone_watermark_unusable_free to factor out common parts between
zone_watermark_fast and __zone_watermark_ok.

This is an example of ALLOC_HARDER allocation failure using v4.19 based
kernel.

 Binder:9343_3: page allocation failure: order:0, mode:0x480020(GFP_ATOMIC), nodemask=(null)
 Call trace:
 [<ffffff8008f40f8c>] dump_stack+0xb8/0xf0
 [<ffffff8008223320>] warn_alloc+0xd8/0x12c
 [<ffffff80082245e4>] __alloc_pages_nodemask+0x120c/0x1250
 [<ffffff800827f6e8>] new_slab+0x128/0x604
 [<ffffff800827b0cc>] ___slab_alloc+0x508/0x670
 [<ffffff800827ba00>] __kmalloc+0x2f8/0x310
 [<ffffff80084ac3e0>] context_struct_to_string+0x104/0x1cc
 [<ffffff80084ad8fc>] security_sid_to_context_core+0x74/0x144
 [<ffffff80084ad880>] security_sid_to_context+0x10/0x18
 [<ffffff800849bd80>] selinux_secid_to_secctx+0x20/0x28
 [<ffffff800849109c>] security_secid_to_secctx+0x3c/0x70
 [<ffffff8008bfe118>] binder_transaction+0xe68/0x454c
 Mem-Info:
 active_anon:102061 inactive_anon:81551 isolated_anon:0
  active_file:59102 inactive_file:68924 isolated_file:64
  unevictable:611 dirty:63 writeback:0 unstable:0
  slab_reclaimable:13324 slab_unreclaimable:44354
  mapped:83015 shmem:4858 pagetables:26316 bounce:0
  free:2727 free_pcp:1035 free_cma:178
 Node 0 active_anon:408244kB inactive_anon:326204kB active_file:236408kB inactive_file:275696kB unevictable:2444kB isolated(anon):0kB isolated(file):256kB mapped:332060kB dirty:252kB writeback:0kB shmem:19432kB writeback_tmp:0kB unstable:0kB all_unreclaimable? no
 Normal free:10908kB min:6192kB low:44388kB high:47060kB active_anon:409160kB inactive_anon:325924kB active_file:235820kB inactive_file:276628kB unevictable:2444kB writepending:252kB present:3076096kB managed:2673676kB mlocked:2444kB kernel_stack:62512kB pagetables:105264kB bounce:0kB free_pcp:4140kB local_pcp:40kB free_cma:712kB
 lowmem_reserve[]: 0 0
 Normal: 505*4kB (H) 357*8kB (H) 201*16kB (H) 65*32kB (H) 1*64kB (H) 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 10236kB
 138826 total pagecache pages
 5460 pages in swap cache
 Swap cache stats: add 8273090, delete 8267506, find 1004381/4060142

This is an example of ALLOC_NO_WATERMARKS allocation failure using v4.14
based kernel.

 kswapd0: page allocation failure: order:0, mode:0x140000a(GFP_NOIO|__GFP_HIGHMEM|__GFP_MOVABLE), nodemask=(null)
 kswapd0 cpuset=/ mems_allowed=0
 CPU: 4 PID: 1221 Comm: kswapd0 Not tainted 4.14.113-18770262-userdebug #1
 Call trace:
 [<0000000000000000>] dump_backtrace+0x0/0x248
 [<0000000000000000>] show_stack+0x18/0x20
 [<0000000000000000>] __dump_stack+0x20/0x28
 [<0000000000000000>] dump_stack+0x68/0x90
 [<0000000000000000>] warn_alloc+0x104/0x198
 [<0000000000000000>] __alloc_pages_nodemask+0xdc0/0xdf0
 [<0000000000000000>] zs_malloc+0x148/0x3d0
 [<0000000000000000>] zram_bvec_rw+0x410/0x798
 [<0000000000000000>] zram_rw_page+0x88/0xdc
 [<0000000000000000>] bdev_write_page+0x70/0xbc
 [<0000000000000000>] __swap_writepage+0x58/0x37c
 [<0000000000000000>] swap_writepage+0x40/0x4c
 [<0000000000000000>] shrink_page_list+0xc30/0xf48
 [<0000000000000000>] shrink_inactive_list+0x2b0/0x61c
 [<0000000000000000>] shrink_node_memcg+0x23c/0x618
 [<0000000000000000>] shrink_node+0x1c8/0x304
 [<0000000000000000>] kswapd+0x680/0x7c4
 [<0000000000000000>] kthread+0x110/0x120
 [<0000000000000000>] ret_from_fork+0x10/0x18
 Mem-Info:
 active_anon:111826 inactive_anon:65557 isolated_anon:0\x0a active_file:44260 inactive_file:83422 isolated_file:0\x0a unevictable:4158 dirty:117 writeback:0 unstable:0\x0a            slab_reclaimable:13943 slab_unreclaimable:43315\x0a mapped:102511 shmem:3299 pagetables:19566 bounce:0\x0a free:3510 free_pcp:553 free_cma:0
 Node 0 active_anon:447304kB inactive_anon:262228kB active_file:177040kB inactive_file:333688kB unevictable:16632kB isolated(anon):0kB isolated(file):0kB mapped:410044kB d irty:468kB writeback:0kB shmem:13196kB writeback_tmp:0kB unstable:0kB all_unreclaimable? no
 Normal free:14040kB min:7440kB low:94500kB high:98136kB reserved_highatomic:32768KB active_anon:447336kB inactive_anon:261668kB active_file:177572kB inactive_file:333768k           B unevictable:16632kB writepending:480kB present:4081664kB managed:3637088kB mlocked:16632kB kernel_stack:47072kB pagetables:78264kB bounce:0kB free_pcp:2280kB local_pcp:720kB free_cma:0kB        [ 4738.329607] lowmem_reserve[]: 0 0
 Normal: 860*4kB (H) 453*8kB (H) 180*16kB (H) 26*32kB (H) 34*64kB (H) 6*128kB (H) 2*256kB (H) 0*512kB 0*1024kB 0*2048kB 0*4096kB = 14232kB

This is trace log which shows GFP_HIGHUSER consumes free pages right
before ALLOC_NO_WATERMARKS.

  <...>-22275 [006] ....   889.213383: mm_page_alloc: page=00000000d2be5665 pfn=970744 order=0 migratetype=0 nr_free=3650 gfp_flags=GFP_HIGHUSER|__GFP_ZERO
  <...>-22275 [006] ....   889.213385: mm_page_alloc: page=000000004b2335c2 pfn=970745 order=0 migratetype=0 nr_free=3650 gfp_flags=GFP_HIGHUSER|__GFP_ZERO
  <...>-22275 [006] ....   889.213387: mm_page_alloc: page=00000000017272e1 pfn=970278 order=0 migratetype=0 nr_free=3650 gfp_flags=GFP_HIGHUSER|__GFP_ZERO
  <...>-22275 [006] ....   889.213389: mm_page_alloc: page=00000000c4be79fb pfn=970279 order=0 migratetype=0 nr_free=3650 gfp_flags=GFP_HIGHUSER|__GFP_ZERO
  <...>-22275 [006] ....   889.213391: mm_page_alloc: page=00000000f8a51d4f pfn=970260 order=0 migratetype=0 nr_free=3650 gfp_flags=GFP_HIGHUSER|__GFP_ZERO
  <...>-22275 [006] ....   889.213393: mm_page_alloc: page=000000006ba8f5ac pfn=970261 order=0 migratetype=0 nr_free=3650 gfp_flags=GFP_HIGHUSER|__GFP_ZERO
  <...>-22275 [006] ....   889.213395: mm_page_alloc: page=00000000819f1cd3 pfn=970196 order=0 migratetype=0 nr_free=3650 gfp_flags=GFP_HIGHUSER|__GFP_ZERO
  <...>-22275 [006] ....   889.213396: mm_page_alloc: page=00000000f6b72a64 pfn=970197 order=0 migratetype=0 nr_free=3650 gfp_flags=GFP_HIGHUSER|__GFP_ZERO
kswapd0-1207  [005] ...1   889.213398: mm_page_alloc: page= (null) pfn=0 order=0 migratetype=1 nr_free=3650 gfp_flags=GFP_NOWAIT|__GFP_HIGHMEM|__GFP_NOWARN|__GFP_MOVABLE

[jaewon31.kim@samsung.com: remove redundant code for high-order]
  Link: http://lkml.kernel.org/r/20200623035242.27232-1-jaewon31.kim@samsung.com

Reported-by: Yong-Taek Lee <ytk.lee@samsung.com>
Suggested-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Jaewon Kim <jaewon31.kim@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Baoquan He <bhe@redhat.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Acked-by: Mel Gorman <mgorman@techsingularity.net>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Yong-Taek Lee <ytk.lee@samsung.com>
Cc: Michal Hocko <mhocko@kernel.org>
Link: http://lkml.kernel.org/r/20200619235958.11283-1-jaewon31.kim@samsung.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Juhyung Park <qkrwngud825@gmail.com>
Change-Id: I23e8131f50f5029920f9f27ec0bea3cbf87b8a40
2023-01-08 11:00:42 +02:00
Jimmy Hu
58d608a9a4 usb: dwc3: Handle charging behavior when usb data is disabled
Bug: 221009551
Test: build, boot
Signed-off-by: Jimmy Hu <hhhuuu@google.com>
Change-Id: I82add2a6cb5e3060c930105b1b8b4f45da85f5f8
2023-01-08 11:00:42 +02:00
Albert Wang
f78f62fe8d usb: dwc3: Set the initial value of usb_data_enabled before use
Fixes: 4b7e37cbcd65 ("usb: new attributes implementation to enable/disable usb data")

Bug: 194649527
Test: build, boot
Signed-off-by: Jimmy Hu <hhhuuu@google.com>
Change-Id: I63f58c3df620e91367b23b405fa0e9a577313964
Signed-off-by: Albert Wang <albertccwang@google.com>
2023-01-08 11:00:42 +02:00
Albert Wang
786f059f70 usb: new attributes implementation to enable/disable usb data
Bug: 188760285
Test: driver probe and attributes access normally
Signed-off-by: Albert Wang <albertccwang@google.com>
Change-Id: I0aec98eebff9454cdec065bb09825f6442ac013b
2023-01-08 11:00:42 +02:00
Danny Lin
6ceb517b8f dtc: Silence warnings
Signed-off-by: Danny Lin <danny@kdrag0n.dev>
2023-01-08 11:00:42 +02:00
Rob Herring
9ae9c8adf6 dtc: update warning settings for new bus and node/property name checks
dtc gained new warnings checking PCI and simple buses, unit address
formatting, and stricter node and property name checking. Disable the
new dtc warnings by default as there are 1000s. As before, warnings are
enabled with W=1 or W=2. The strict node and property name checks are a
bit subjective, so they are only enabled for W=2.

Signed-off-by: Rob Herring <robh@kernel.org>
2023-01-08 11:00:41 +02:00
Wilson Sung
8fc8d7d2fe msm: cleanup: struct gsi_wdi2_channel_scratch2_reg
Remove __packed from the usage of union gsi_wdi3_channel_scratch2_reg.
__packed is only needed in the union inclusion.

Bug: 152368391
Change-Id: I7a5df200b4cbf12b5bcbe13497987b696eec76b8
Signed-off-by: Wilson Sung <wilsonsung@google.com>
2023-01-08 11:00:41 +02:00
Petri Gynther
3efd97c2f2 msm: cleanup: struct gsi_mhi_channel_scratch
Remove __packed from the usage of struct gsi_mhi_channel_scratch.
__packed is only needed in the struct definition and one union inclusion.

include/linux/msm_gsi.h:
struct __packed gsi_mhi_channel_scratch {
    ...
}

union __packed gsi_channel_scratch {
    ...
    struct __packed gsi_mhi_channel_scratch mhi;
    ...
}

Bug: 139442076
Bug: 139808631
Bug: 142366585
Change-Id: Ic07de9a164b88238bbe8655252b65783d846e933
Signed-off-by: Petri Gynther <pgynther@google.com>
(cherry picked from commit 43edfaab5f33aaa199f109e6c227221dbd13eac2)
2023-01-08 11:00:41 +02:00
Petri Gynther
94e2f5f84d msm: cleanup: union gsi_evt_scratch
Remove __packed from the usage of union gsi_evt_scratch.
__packed is only needed in the union definition.

include/linux/msm_gsi.h:
union __packed gsi_evt_scratch {
    ...
}

Bug: 139442076
Bug: 139808631
Bug: 142366585
Change-Id: If3d0e1bc2674f01d5a9a02e73d33b28a648539bc
Signed-off-by: Petri Gynther <pgynther@google.com>
(cherry picked from commit 33c2fa85bdfd90436d4c975757eefc6706a785c5)
2023-01-08 11:00:41 +02:00
Petri Gynther
64a3942bc7 msm: cleanup: union gsi_wdi_channel_scratch3_reg
Remove __packed from the usage of union gsi_wdi_channel_scratch3_reg.
__packed is only needed in the union definition.

include/linux/msm_gsi.h:
union __packed gsi_wdi_channel_scratch3_reg {
    ...
}

Bug: 139442076
Bug: 139808631
Bug: 142366585
Change-Id: I70edc50fbbe4c004309f76c020ac4d77cad91aad
Signed-off-by: Petri Gynther <pgynther@google.com>
(cherry picked from commit 2871c785dd89dd0926d12a93161fca6e27a6cd2e)
2023-01-08 11:00:41 +02:00
neoyu
e5c7443adf msm: cleanup: union gsi_channel_scratch
Remove __packed from the usage of union gsi_channel_scratch.
__packed is only needed in the union definition.

include/linux/msm_gsi.h:
union __packed gsi_channel_scratch {
    ...
}

Bug: 139442076
Bug: 139808631
Bug: 142366585
Change-Id: If59d3d217e6a4bae92b9931523e2f89a39a04be9
Signed-off-by: Petri Gynther <pgynther@google.com>
(cherry picked from commit 54ace836af62b9fc1edff9c3a436064e177fe2e4)
2023-01-08 11:00:40 +02:00
Arian
a3a819195d ASoC: wcd_cpe_core: Fix snprintf size
techpack/audio/asoc/codecs/wcd_cpe_core.c:1981:2: error: 'snprintf' size argument is too large; destination buffer has size 11, but size argument is 13 [-Werror,-Wfortify-source]
        snprintf(proc_name, (sizeof("cpe") + sizeof("_state") +
        ^
1 error generated.

Change-Id: I976c005263f44d7a97f1496304acf28df30232a1
2023-01-08 11:00:40 +02:00
Soumya Managoli
254d6b1e1e ASoC: Fix overflow error in routing driver
The reg in soc_dapm_mux is 32-bit. The BE DAI ID passed
as shift(to be operated on the reg) may be more than 31,
which may cause overflow.
Set reg field to SND_SOC_NOPM to avoid any DAPM operation
while passing BE IDs in shift_l field and hence avoid overflow.

Change-Id: Ibbbca04c61b7c56eb4c5a7485a4e93dc28a09709
Signed-off-by: Soumya Managoli <smanag@codeaurora.org>
[dereference23: Forward port to 4.14]
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
2023-01-08 11:00:40 +02:00
Jimmy Hu
fdd0a8c845 usb: fix undefined behavior caused by zero-length array
The use of zero-length array causes undefined behavior.
Replace zero-length array with flexible-array member.

Bug: 174330770
Test: build pass and boot to home
Change-Id: I080ed1555d5b60075f6a86aa0ac15427529f7a1b
Signed-off-by: Jimmy Hu <hhhuuu@google.com>
Signed-off-by: Puma Hsu <pumahsu@google.com>
2023-01-08 11:00:40 +02:00
Jeya R
e46a2eed9f BACKPORT: msm: adsprpc: Allocate buffer taking NULL byte into consideration
When attaching to audiopd on ADSP, allocate one
extra byte for the process name so that it is
null terminated when data is copied from file
pointer in the userspace.

Change-Id: Iffb9ef5cb0198ff7cbf44d0f3be03a1c9f29a90f
Acked-by: Vishnu Karthik D <vikarthi@qti.qualcomm.com>
Signed-off-by: Jeya R <jeyr@codeaurora.org>
(cherry-picked from commit 4d5a6020f9fc49c83e7808a63a2a8088225cde81)
[ASB_2021-10-05 / CVE-2021-30306 / Ref. ID A-193071117 - QC-CR#2915692]
Signed-off-by: Albert I <kras@raphielgang.org>
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
2023-01-08 11:00:40 +02:00
JJ Lee
2f1d3c5f79 char: adsprpc: fix global-out-of-bounds error
The array fastrpc_rpmsg_match is not ended with {}, out-of-bounds access
might occur when enumerating the ids listed in fastrpc_rpmsg_match.
Added {} to prevent out-of-bounds access.

bug: 189164670
Change-Id: Ia18e70c7739fca242c70187083c8fc651f98e968
Signed-off-by: JJ Lee <leejj@google.com>
2023-01-08 11:00:39 +02:00
Pratham Pratap
70fdc4ee5a usb: f_fs: Avoid invalid pointer access in ffs_fs_get_tree
Consider a case where ffs_data_new is getting called from
ffs_fs_get_tree and ffs_data_new returns error pointer since
the function (e.g. adb) is already mounted. The driver is only
checking for the NULL return value for ffs but in this case it
will not be NULL, which will fail the check and driver will go
ahead accessing invalid pointer which can lead to inconsistencies.

Fix this by having NULL as well as error pointer check for ffs.

Change-Id: Idad5a0b91148325258ea3f545d4da71644c7fc53
Signed-off-by: Pratham Pratap <prathampratap@codeaurora.org>
2023-01-08 11:00:39 +02:00
Ivan Vecera
71f7873176 mmc: sdhci-msm: Fix array-index-out-of-bounds
INVALID_TUNING_PHASE is defined to -1 but saved_tuning_phase is defined
as an unsigned integer. This causes the following UBSAN warning:

[    1.150177] UBSAN: Undefined behaviour in ../../../../../../kernel/xiaomi/sm6250/drivers/mmc/host/sdhci-msm.c:542:2
[    1.150180] index 255 is out of range for type 'u8 [16]'
[    1.150185] CPU: 6 PID: 87 Comm: kworker/6:1 Tainted: G S              4.14.190-lineageos-ge44e3bc2e-dirty #17
[    1.150187] Hardware name: Qualcomm Technologies, Inc. ATOLL-AB PM6150 wcd937x Audio Codec AB IDP CURTANA (DT)
[    1.150196] Workqueue: events_freezable mmc_rescan
[    1.150199] Call trace:
[    1.150204] dump_backtrace+0x0/0x1d0
[    1.150208] show_stack+0x18/0x24
[    1.150213] dump_stack+0xd8/0x114
[    1.150217] __ubsan_handle_out_of_bounds+0xc8/0x104
[    1.150220] msm_config_cm_dll_phase+0x238/0x248
[    1.150222] sdhci_msm_execute_tuning+0x2a0/0xb24
[    1.150225] sdhci_execute_tuning+0xcc/0x6c0
[    1.150228] mmc_execute_tuning+0x6c/0xc0
[    1.150230] mmc_sd_init_card+0x62c/0x6e0
[    1.150233] mmc_attach_sd+0xbc/0x2cc
[    1.150235] mmc_rescan+0x2ac/0x3a4
[    1.150239] process_one_work+0x260/0x45c
[    1.150241] worker_thread+0x258/0x494
[    1.150244] kthread+0x11c/0x12c
[    1.150247] ret_from_fork+0x10/0x18

Fix it by changing the saved_tuning_phase definition to a signed integer.

Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
Change-Id: I9f53d4c7a7a543e77f6538253c485af61c0e7684
2023-01-08 11:00:39 +02:00
Nathan Chancellor
e69da001cf mmc: sdio: Fix strlcpy usage
Fixes the following clang warning:

../drivers/mmc/core/sdio_cis.c:58:31: warning: size argument in
'strlcpy' call appears to be size of the source; expected the size of
the destination [-Wstrlcpy-strlcat-size]

Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: khusika <khusikadhamar@gmail.com>
Change-Id: I1b35b56039e03fb3bf6572037fa2421302c6fe32
2023-01-08 11:00:39 +02:00
Sultan Alsawaf
7a9f779e29 msm: camera: Fix trivial misleading indentation warnings
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Change-Id: I98e527a4ab0bff6e3e63a09b6ec556af6ba6f8d9
2023-01-08 11:00:39 +02:00
Sultan Alsawaf
d85d6cd1da lib/nlattr.c: Fix warning due to incorrect strlen() variable type
strlen() returns a size_t, not an int.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Change-Id: If5b0e3eb9d237f88ae96301ca4736c08ffe139cc
2023-01-08 11:00:38 +02:00
Sultan Alsawaf
85ee302991 msm: vidc: Fix uninitialized tag_data usage
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Change-Id: I3839d059c7666250519423c5417bcc4b3785d0e2
2023-01-08 11:00:38 +02:00
Sultan Alsawaf
054688975c ASoC: msm-pcm-routing-v2: Fix non-blocking if-statement warning
Change-Id: Ia33743c8770dbb3cffe52aa1b57faa3267f37d8f
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
[dereference23: Extend to audio-kernel 4.0]
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
2023-01-08 11:00:38 +02:00
Sultan Alsawaf
2d0d70f187 ASoC: dsp: msm-dts-srs-tm-config: Fix trivial unguarded pr_debug()
Change-Id: If2b6b67afafddc749557a2230582fbacd1c85c26
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
[dereference23: Extend to audio-kernel 4.0]
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
2023-01-08 11:00:38 +02:00
Sultan Alsawaf
3380585247 ASoC: dsp: amrwb_in: Fix AUDIO_GET_AMRWB_ENC_CONFIG ioctl
The non-blocking if-statement here causes the AUDIO_GET_AMRWB_ENC_CONFIG
ioctl to always return -EFAULT, even upon success. Fix it by correctly
guarding the -EFAULT return value.

Change-Id: Ia3a7247f5febb21d3b654c0ed29e81135e732c79
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
[dereference23: Extend to audio-kernel 4.0]
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
2023-01-08 11:00:38 +02:00
Sultan Alsawaf
612b48f6ac msm: ipa: Fix size check in ipa_debugfs_enable_disable_drop_stats()
Change-Id: Ibcdd724573b20703ff144eefec1f382d59f10fdb
2023-01-08 11:00:37 +02:00
Sultan Alsawaf
66da1d1fce msm: ipa: Refactor buffer size check in ipa3_write()
This confuses GCC's FORTIFY_SOURCE check for the copy_from_user() in
this function. Simplify it to resolve the GCC warning.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Change-Id: I963ae2b81e4ac7cb46c08ece73bb7cd1201a621e
2023-01-08 11:00:37 +02:00
Sultan Alsawaf
ceb9401181 msm_geni_serial: Fix format specifier warnings due to transposed args
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Change-Id: I6178286e411ea03d1b4ad6cb33b4ed4cc9354903
2023-01-08 11:00:37 +02:00
Sultan Alsawaf
38307e28e6 thermal: tsens: Fix exported function marked as static
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Change-Id: Id4a2e452c3ec31a747abc3d043f105c5b025609a
2023-01-08 11:00:37 +02:00
Sultan Alsawaf
f3b5dfb17a smb5-lib: Fix misleading indentation warning due to missing braces
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Change-Id: Ic0463785333cce49458f402d97b8335d772e277f
2023-01-08 11:00:37 +02:00
Sultan Alsawaf
35114e6b07 msm: ipa3: Fix non-atomic read on atomic_t variable
Accessing an atomic variable without the atomic_*() helpers is illegal.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Change-Id: Ie2205c438ad0824f80b92d72e40c4618e6ec35aa
2023-01-08 11:00:36 +02:00
Sultan Alsawaf
9eba0d7cb9 msm: ipa3: Fix format specifier warnings
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Change-Id: I2e29ba5da971347c16a2658ef393dd6e06113b3c
2023-01-08 11:00:36 +02:00
Sultan Alsawaf
d3405fd9d8 cnss_utils: Fix unused function warnings when CONFIG_CNSS_TIMESYNC=n
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Change-Id: Ia9c5f6fac54f4da5811928861f370e4525db4c0e
2023-01-08 11:00:36 +02:00
Sultan Alsawaf
f868d7c654 msm: npu: Fix format specifier warnings
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Change-Id: I398d9beab9964f371603646d8a3eab5538139366
2023-01-08 11:00:36 +02:00
Sultan Alsawaf
4860ba4671 msm: camera: Remove nonsensical register reads in cam_vfe_fe_reg_dump()
soc_private->cpas_handle is an array of registers; passing it wholesale
and casting the error away is completely wrong. Since it's unclear which
register is intended to be read here, just remove the nonsensical code
entirely.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Change-Id: I94e895b09e1cff81f2b368efda18cb77eb63ee43
2023-01-08 11:00:36 +02:00
Sultan Alsawaf
83cc26495d msm: camera: Fix misleading indentation warnings due to missing braces
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Change-Id: I772976f522f7c4bb62237267dd090e9536cfd476
2023-01-08 11:00:36 +02:00
Sultan Alsawaf
6540e0e416 arm64: arch_timer: Fix unused function warnings when OOL_WORKAROUND=n
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Change-Id: Ie6f0487fa8628ff18a06183d5c05e28c8a96cdb4
2023-01-08 11:00:35 +02:00
Sultan Alsawaf
9324d9dbe4 mhi: core: Fix unchecked must_check sysfs_create_group() return value
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Change-Id: I93f2b678684e6fc87567e1a21158f95e9ff49e61
2023-01-08 11:00:35 +02:00
Sultan Alsawaf
467b7b4031 mhi: core: Fix unchecked must_check mhi_read_reg_field() return value
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Change-Id: I632f5e5f92d8d599e1d37b1c1bb298ed2fdcbee4
2023-01-08 11:00:35 +02:00
Sultan Alsawaf
87d1a2f55f mhi: core: Fix format specifier warnings
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Change-Id: I7602111f2f646d5bbab12cd7525923fd0bf7554a
2023-01-08 11:00:35 +02:00
Nick Desaulniers
cd36374260 msm: camera: icp: fix -Wunsequenced
Fixes:
drivers/media/platform/msm/camera_floral/cam_icp/icp_hw/icp_hw_mgr/cam_icp_hw_mgr.c:3481:17:
error: multiple unsequenced modifications to 'num_cmd_buf'
[-Werror,-Wunsequenced]
num_cmd_buf-- : 0;
           ^
drivers/media/platform/msm/camera_floral/cam_icp/icp_hw/icp_hw_mgr/cam_icp_hw_mgr.c:3505:17:
error: multiple unsequenced modifications to 'num_cmd_buf'
[-Werror,-Wunsequenced]
num_cmd_buf-- : 0;
           ^

Bug: 155426751
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Change-Id: I0bdcf704fdce60d103143843ed9890330650b84e
2023-01-08 11:00:35 +02:00
Nick Desaulniers
35669d70c7 kconfig: fix -Wmisleading-indentation
Fixes:
scripts/kconfig/symbol.c:1153:4: warning: misleading indentation;
statement is not part of the previous 'if' [-Wmisleading-indentation]
fprintf(stderr, "For a resolution refer to Documentation/kbuild/kconfig-language.txt\n");
^
scripts/kconfig/symbol.c:1150:3: note: previous statement is here
if (stack->sym == last_sym)
^

This code has been significantly rewritten upstream, it's not worth
backporting IMO.

Bug: 155426751
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Change-Id: I22f8317f7b92f59a9bd810593cbf3aacb4b73c5e
2023-01-08 11:00:34 +02:00
Nick Desaulniers
ddb9d5da57 msm: camera: isp: fix -Wpointer-to-int-cast
Fixes:
drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_fe_ver1.c:399:20:
error: cast to smaller integer type 'uint32_t' (aka 'unsigned int') from
'uint32_t *' (aka 'unsigned int *') [-Werror,-Wpointer-to-int-cast]
cam_cpas_reg_read((uint32_t)soc_private->cpas_handle,
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_fe_ver1.c:403:20:
error: cast to smaller integer type 'uint32_t' (aka 'unsigned int') from
'uint32_t *' (aka 'unsigned int *') [-Werror,-Wpointer-to-int-cast]
cam_cpas_reg_read((uint32_t)soc_private->cpas_handle,
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This code should be carefully reviewed, as this looks like the compiler
has highlighted a bug.  Based on the use of soc_private->cpas_handle
being passed to cam_cpas_reg_read in another translation unit,
drivers/media/platform/msm/camera_floral/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver2.c
I suspect that they meant to use the first element's value, not the
address of the first element, truncated to 32b.

Bug: 155426751
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Change-Id: I966e41000aec72c5d117cbce5097128daa818a3d
2023-01-08 11:00:34 +02:00
Nick Desaulniers
922485b9c9 msm: camera: icp: fix -Wunsequenced
Fixes:
drivers/media/platform/msm/camera/cam_icp/icp_hw/icp_hw_mgr/cam_icp_hw_mgr.c:3481:17:
error: multiple unsequenced modifications to 'num_cmd_buf'
[-Werror,-Wunsequenced]
num_cmd_buf-- : 0;
           ^
drivers/media/platform/msm/camera/cam_icp/icp_hw/icp_hw_mgr/cam_icp_hw_mgr.c:3505:17:
error: multiple unsequenced modifications to 'num_cmd_buf'
[-Werror,-Wunsequenced]
num_cmd_buf-- : 0;
           ^

This code is decrementing num_cmd_buf, but clamping it at 0.

See:
commit 05349feaa2032 ("Camera: Bring over camera driver changes")
to techpack/camera/drivers/cam_icp/icp_hw/icp_hw_mgr/cam_icp_hw_mgr.c
in newer device's kernels.

Bug: 155426751
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Change-Id: Ib55cd21f9298c125294d55837dc96bff9d7bc9e7
(cherry picked from commit 0d84d28ff30809c2e925eca06ecfda110e67c45b)
2023-01-08 11:00:34 +02:00
Nick Desaulniers
0cba594311 soc: qcom: spcom: fix section mismatch warning
The KASAN builds have started producing the warning:
WARNING: vmlinux.o(.text+0x8cad78): Section mismatch in reference from the function spcom_probe() to the function .init.text:spcom_register_chardev()
The function spcom_probe() references
the function __init spcom_register_chardev().
This is often because spcom_probe lacks a __init
annotation or the annotation of spcom_register_chardev is wrong.

Indeed, spcom_register_chardev is called from the non-__init
spcom_probe, so marking spcom_register_chardev __init is dangerous.

Bug: 139442076
Change-Id: I8feff354bcea8171d8f8130cfa8a230439efc9b0
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
2023-01-08 11:00:34 +02:00
Nick Desaulniers
02cc7522cc Revert "arm64: spinlock: Drop the prfm from arch_spin_trylock"
This reverts commit 00d37423ce.

Causes the following assembler errors:
/tmp/spinlock_debug-15a9d8.s:441: Error: attempt to move .org backwards

The reverted commit is an out of tree patch that does not exist in
4.14.y upstream.  Mainline has outright removed the arch_spin_trylock()
function in this translation units.

See also from mainline:
commit a4c1887d4c14 ("locking/arch: Remove dummy
arch_{read,spin,write}_lock_flags() implementations")
commit c11090474d70 ("arm64: locking: Replace ticket lock implementation
with qspinlock")

Bug: 117152549
Change-Id: I3eb40e5d18ed22c4e3ff1d2b8707e784067aabac
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
2023-01-08 11:00:34 +02:00
Nick Desaulniers
ad55e1dc5f Revert "selinux: Relocate ss_initialized and selinux_enforcing to separate 4k"
This reverts commit d4807bd60d.

That out of tree patch causes the resulting kernel image to be too
large, causing ld.lld to error; likely due to the additional section and
alignment requirements.  Android and floral don't host virtual targets
and thus do not run at EL2 on arm64.

Bug: 63740206
Change-Id: I357bf4d5c7e29230746eacd51fef413acec06067
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
2023-01-08 11:00:33 +02:00
Volodymyr Zhdanov
6dcf468f61 Revert "RTIC: Move selinux_state to a separate 4k"
This reverts commit 1643169778.

Change-Id: I588e0f3b4703813422f97ab3042a16eaa3f243e0
2023-01-08 11:00:33 +02:00
Danny Lin
59f24c4046 Revert "ANDROID: HACK: arm64, LLVMLinux: use -mno-implicit-float"
This reverts commit 1416d1c439.

Unnecessary with Clang 6.0+.

Signed-off-by: Danny Lin <danny@kdrag0n.dev>
Change-Id: I6f29ca050566e9027e51605e64bf6893602344ef
2023-01-08 11:00:33 +02:00