Skip to content

Commit 1eec0b4

Browse files
Ben Rombergerfourkbomb
Ben Romberger
authored andcommitted
ASoC: msm: qdsp6v2: Change audio drivers to use %pK
Change all qdsp6v2 audio driver to use %pK instead of %p. %pK hides addresses when the users doesn't have kernel permissions. If address information is needed echo 0 > /proc/sys/kernel/kptr_restrict. Signed-off-by: Ben Romberger <[email protected]> Signed-off-by: Surendar karka <[email protected]> (cherry picked from commit bb2bc015d50dd7e8158e36e8eec0f6000469155a) Change-Id: I16d0103fbb5356506f0287732bbcfe83c79e4ace
1 parent fc0f8c5 commit 1eec0b4

19 files changed

+138
-138
lines changed

Diff for: arch/arm/mach-msm/qdsp6v2/amrwb_in.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ static int amrwb_in_open(struct inode *inode, struct file *file)
195195
(void *)audio);
196196

197197
if (!audio->ac) {
198-
pr_err("%s:audio[%p]: Could not allocate memory for audio"
198+
pr_err("%s:audio[%pK]: Could not allocate memory for audio"
199199
"client\n", __func__, audio);
200200
kfree(audio->enc_cfg);
201201
kfree(audio);

Diff for: arch/arm/mach-msm/qdsp6v2/apr.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ void apr_cb_func(void *buf, int len, void *priv)
326326
pr_debug("\n*****************\n");
327327

328328
if (!buf || len <= APR_HDR_SIZE) {
329-
pr_err("APR: Improper apr pkt received:%p %d\n", buf, len);
329+
pr_err("APR: Improper apr pkt received:%pK %d\n", buf, len);
330330
return;
331331
}
332332
hdr = buf;
@@ -407,7 +407,7 @@ void apr_cb_func(void *buf, int len, void *priv)
407407
return;
408408
}
409409
pr_debug("svc_idx = %d\n", i);
410-
pr_debug("%x %x %x %p %p\n", c_svc->id, c_svc->dest_id,
410+
pr_debug("%x %x %x %pK %pK\n", c_svc->id, c_svc->dest_id,
411411
c_svc->client_id, c_svc->fn, c_svc->priv);
412412
data.payload_size = hdr->pkt_size - hdr_size;
413413
data.opcode = hdr->opcode;
@@ -471,7 +471,7 @@ static void apr_reset_deregister(struct work_struct *work)
471471
container_of(work, struct apr_reset_work, work);
472472

473473
handle = apr_reset->handle;
474-
pr_debug("%s:handle[%p]\n", __func__, handle);
474+
pr_debug("%s:handle[%pK]\n", __func__, handle);
475475
apr_deregister(handle);
476476
kfree(apr_reset);
477477
}
@@ -504,7 +504,7 @@ int apr_deregister(void *handle)
504504
client[dest_id][client_id].svc_cnt--;
505505
if (!client[dest_id][client_id].svc_cnt) {
506506
svc->need_reset = 0x0;
507-
pr_debug("%s: service is reset %p\n", __func__, svc);
507+
pr_debug("%s: service is reset %pK\n", __func__, svc);
508508
}
509509
}
510510

@@ -532,7 +532,7 @@ void apr_reset(void *handle)
532532

533533
if (!handle)
534534
return;
535-
pr_debug("%s: handle[%p]\n", __func__, handle);
535+
pr_debug("%s: handle[%pK]\n", __func__, handle);
536536

537537
if (apr_reset_workqueue == NULL) {
538538
pr_err("%s: apr_reset_workqueue is NULL\n", __func__);

Diff for: arch/arm/mach-msm/qdsp6v2/audio_aac.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,10 @@ static long audio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
171171
break;
172172
}
173173
default:
174-
pr_debug("%s[%p]: Calling utils ioctl\n", __func__, audio);
174+
pr_debug("%s[%pK]: Calling utils ioctl\n", __func__, audio);
175175
rc = audio->codec_ioctl(file, cmd, arg);
176176
if (rc)
177-
pr_err("%s[%p]:Failed in utils_ioctl: %d\n",
177+
pr_err("%s[%pK]:Failed in utils_ioctl: %d\n",
178178
__func__, audio, rc);
179179
}
180180
return rc;

Diff for: arch/arm/mach-msm/qdsp6v2/audio_amrnb.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ static long audio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
3030

3131
switch (cmd) {
3232
case AUDIO_START: {
33-
pr_debug("%s[%p]: AUDIO_START session_id[%d]\n", __func__,
33+
pr_debug("%s[%pK]: AUDIO_START session_id[%d]\n", __func__,
3434
audio, audio->ac->session);
3535
if (audio->feedback == NON_TUNNEL_MODE) {
3636
/* Configure PCM output block */
@@ -59,7 +59,7 @@ static long audio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
5959
break;
6060
}
6161
default:
62-
pr_debug("%s[%p]: Calling utils ioctl\n", __func__, audio);
62+
pr_debug("%s[%pK]: Calling utils ioctl\n", __func__, audio);
6363
rc = audio->codec_ioctl(file, cmd, arg);
6464
}
6565
return rc;

Diff for: arch/arm/mach-msm/qdsp6v2/audio_amrwb.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ static long audio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
3131

3232
switch (cmd) {
3333
case AUDIO_START: {
34-
pr_debug("%s[%p]: AUDIO_START session_id[%d]\n", __func__,
34+
pr_debug("%s[%pK]: AUDIO_START session_id[%d]\n", __func__,
3535
audio, audio->ac->session);
3636
if (audio->feedback == NON_TUNNEL_MODE) {
3737
/* Configure PCM output block */
@@ -62,7 +62,7 @@ static long audio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
6262
break;
6363
}
6464
default:
65-
pr_debug("%s[%p]: Calling utils ioctl\n", __func__, audio);
65+
pr_debug("%s[%pK]: Calling utils ioctl\n", __func__, audio);
6666
rc = audio->codec_ioctl(file, cmd, arg);
6767
}
6868
return rc;

Diff for: arch/arm/mach-msm/qdsp6v2/audio_amrwbplus.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ static long audio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
5050

5151
switch (cmd) {
5252
case AUDIO_START: {
53-
pr_err("%s[%p]: AUDIO_START session_id[%d]\n", __func__,
53+
pr_err("%s[%pK]: AUDIO_START session_id[%d]\n", __func__,
5454
audio, audio->ac->session);
5555
if (audio->feedback == NON_TUNNEL_MODE) {
5656
/* Configure PCM output block */
@@ -134,7 +134,7 @@ static long audio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
134134
break;
135135
}
136136
default:
137-
pr_debug("%s[%p]: Calling utils ioctl\n", __func__, audio);
137+
pr_debug("%s[%pK]: Calling utils ioctl\n", __func__, audio);
138138
rc = audio->codec_ioctl(file, cmd, arg);
139139
}
140140
return rc;

Diff for: arch/arm/mach-msm/qdsp6v2/audio_evrc.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ static long audio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
3333

3434
switch (cmd) {
3535
case AUDIO_START: {
36-
pr_debug("%s[%p]: AUDIO_START session_id[%d]\n", __func__,
36+
pr_debug("%s[%pK]: AUDIO_START session_id[%d]\n", __func__,
3737
audio, audio->ac->session);
3838
if (audio->feedback == NON_TUNNEL_MODE) {
3939
/* Configure PCM output block */
@@ -64,7 +64,7 @@ static long audio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
6464
break;
6565
}
6666
default:
67-
pr_debug("%s[%p]: Calling utils ioctl\n", __func__, audio);
67+
pr_debug("%s[%pK]: Calling utils ioctl\n", __func__, audio);
6868
rc = audio->codec_ioctl(file, cmd, arg);
6969
}
7070
return rc;

Diff for: arch/arm/mach-msm/qdsp6v2/audio_lpa.c

+13-13
Original file line numberDiff line numberDiff line change
@@ -441,9 +441,9 @@ static int audlpa_ion_check(struct audio *audio,
441441
list_for_each_entry(region_elt, &audio->ion_region_queue, list) {
442442
if (CONTAINS(region_elt, &t) || CONTAINS(&t, region_elt) ||
443443
OVERLAPS(region_elt, &t)) {
444-
pr_err("%s[%p]:region (vaddr %p len %ld)"
444+
pr_err("%s[%pK]:region (vaddr %pK len %ld)"
445445
" clashes with registered region"
446-
" (vaddr %p paddr %p len %ld)\n",
446+
" (vaddr %pK paddr %pK len %ld)\n",
447447
__func__, audio, vaddr, len,
448448
region_elt->vaddr,
449449
(void *)region_elt->paddr, region_elt->len);
@@ -465,7 +465,7 @@ static int audlpa_ion_add(struct audio *audio,
465465
unsigned long ionflag;
466466
void *temp_ptr;
467467

468-
pr_debug("%s[%p]:\n", __func__, audio);
468+
pr_debug("%s[%pK]:\n", __func__, audio);
469469
region = kmalloc(sizeof(*region), GFP_KERNEL);
470470

471471
if (!region) {
@@ -512,14 +512,14 @@ static int audlpa_ion_add(struct audio *audio,
512512
region->kvaddr = kvaddr;
513513
region->len = len;
514514
region->ref_cnt = 0;
515-
pr_debug("%s[%p]:add region paddr %lx vaddr %p, len %lu kvaddr %lx\n",
515+
pr_debug("%s[%pK]:add region paddr %lx vaddr %pK, len %lu kvaddr %lx\n",
516516
__func__, audio,
517517
region->paddr, region->vaddr, region->len, region->kvaddr);
518518
list_add_tail(&region->list, &audio->ion_region_queue);
519519

520520
rc = q6asm_memory_map(audio->ac, (uint32_t)paddr, IN, (uint32_t)len, 1);
521521
if (rc < 0) {
522-
pr_err("%s[%p]: memory map failed\n", __func__, audio);
522+
pr_err("%s[%pK]: memory map failed\n", __func__, audio);
523523
goto ion_error;
524524
} else {
525525
goto end;
@@ -549,15 +549,15 @@ static int audlpa_ion_remove(struct audio *audio,
549549
if (region != NULL && (region->fd == info->fd) &&
550550
(region->vaddr == info->vaddr)) {
551551
if (region->ref_cnt) {
552-
pr_debug("%s[%p]:region %p in use ref_cnt %d\n",
552+
pr_debug("%s[%pK]:region %pK in use ref_cnt %d\n",
553553
__func__, audio, region,
554554
region->ref_cnt);
555555
break;
556556
}
557557
rc = q6asm_memory_unmap(audio->ac,
558558
(uint32_t) region->paddr, IN);
559559
if (rc < 0)
560-
pr_err("%s[%p]: memory unmap failed\n",
560+
pr_err("%s[%pK]: memory unmap failed\n",
561561
__func__, audio);
562562

563563
list_del(&region->list);
@@ -595,14 +595,14 @@ static int audlpa_ion_lookup_vaddr(struct audio *audio, void *addr,
595595
}
596596

597597
if (match_count > 1) {
598-
pr_err("%s[%p]:multiple hits for vaddr %p, len %ld\n",
598+
pr_err("%s[%pK]:multiple hits for vaddr %pK, len %ld\n",
599599
__func__, audio, addr, len);
600600
list_for_each_entry(region_elt, &audio->ion_region_queue,
601601
list) {
602602
if (addr >= region_elt->vaddr &&
603603
addr < region_elt->vaddr + region_elt->len &&
604604
addr + len <= region_elt->vaddr + region_elt->len)
605-
pr_err("\t%s[%p]:%p, %ld --> %p\n",
605+
pr_err("\t%s[%pK]:%pK, %ld --> %pK\n",
606606
__func__, audio,
607607
region_elt->vaddr,
608608
region_elt->len,
@@ -620,7 +620,7 @@ static unsigned long audlpa_ion_fixup(struct audio *audio, void *addr,
620620

621621
ret = audlpa_ion_lookup_vaddr(audio, addr, len, &region);
622622
if (ret) {
623-
pr_err("%s[%p]:lookup (%p, %ld) failed\n",
623+
pr_err("%s[%pK]:lookup (%pK, %ld) failed\n",
624624
__func__, audio, addr, len);
625625
return 0;
626626
}
@@ -1100,10 +1100,10 @@ static void audlpa_unmap_ion_region(struct audio *audio)
11001100
struct list_head *ptr, *next;
11011101
int rc = -EINVAL;
11021102

1103-
pr_debug("%s[%p]:\n", __func__, audio);
1103+
pr_debug("%s[%pK]:\n", __func__, audio);
11041104
list_for_each_safe(ptr, next, &audio->ion_region_queue) {
11051105
region = list_entry(ptr, struct audlpa_ion_region, list);
1106-
pr_debug("%s[%p]: phy_address = 0x%lx\n",
1106+
pr_debug("%s[%pK]: phy_address = 0x%lx\n",
11071107
__func__, audio, region->paddr);
11081108
if (region != NULL) {
11091109
rc = q6asm_memory_unmap(audio->ac,
@@ -1385,7 +1385,7 @@ static int audio_open(struct inode *inode, struct file *file)
13851385
pr_err("Unable to create ION client\n");
13861386
goto err;
13871387
}
1388-
pr_debug("Allocating ION clinet in audio_open %p", audio->client);
1388+
pr_debug("Allocating ION clinet in audio_open %pK", audio->client);
13891389
done:
13901390
return rc;
13911391
err:

Diff for: arch/arm/mach-msm/qdsp6v2/audio_mp3.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ static long audio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
3030
int rc = 0;
3131
switch (cmd) {
3232
case AUDIO_START: {
33-
pr_debug("%s[%p]: AUDIO_START session_id[%d]\n", __func__,
33+
pr_debug("%s[%pK]: AUDIO_START session_id[%d]\n", __func__,
3434
audio, audio->ac->session);
3535
if (audio->feedback == NON_TUNNEL_MODE) {
3636
/* Configure PCM output block */
@@ -61,7 +61,7 @@ static long audio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
6161
break;
6262
}
6363
default:
64-
pr_debug("%s[%p]: Calling utils ioctl\n", __func__, audio);
64+
pr_debug("%s[%pK]: Calling utils ioctl\n", __func__, audio);
6565
rc = audio->codec_ioctl(file, cmd, arg);
6666
}
6767
return rc;

Diff for: arch/arm/mach-msm/qdsp6v2/audio_qcelp.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ static long audio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
3333

3434
switch (cmd) {
3535
case AUDIO_START: {
36-
pr_debug("%s[%p]: AUDIO_START session_id[%d]\n", __func__,
36+
pr_debug("%s[%pK]: AUDIO_START session_id[%d]\n", __func__,
3737
audio, audio->ac->session);
3838
if (audio->feedback == NON_TUNNEL_MODE) {
3939
/* Configure PCM output block */
@@ -64,7 +64,7 @@ static long audio_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
6464
break;
6565
}
6666
default:
67-
pr_debug("%s[%p]: Calling utils ioctl\n", __func__, audio);
67+
pr_debug("%s[%pK]: Calling utils ioctl\n", __func__, audio);
6868
rc = audio->codec_ioctl(file, cmd, arg);
6969
}
7070
return rc;

Diff for: arch/arm/mach-msm/qdsp6v2/audio_utils.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ ssize_t audio_in_read(struct file *file,
479479
count -= bytes_to_copy;
480480
buf += bytes_to_copy;
481481
} else {
482-
pr_err("%s:session id %d: short read data[%p]"
482+
pr_err("%s:session id %d: short read data[%pK]"
483483
"bytesavail[%d]bytesrequest[%d]\n", __func__,
484484
audio->ac->session,
485485
data, size, count);

0 commit comments

Comments
 (0)