Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9b2acba1 authored by Vamsi Krishna Samavedam's avatar Vamsi Krishna Samavedam Committed by Mayank Rana
Browse files

sound: usb: replace %p with %pK



Format specifier %p can leak kernel addresses while not valuing the
kptr_restrict system settings. When kptr_restrict is set to (1), kernel
pointers printed using the %pK format specifier will be replaced with 0's.
Debugging Note : &pK prints only Zeros as address. If you need actual
address information, write 0 to kptr_restrict.

echo 0 > /proc/sys/kernel/kptr_restrict

Change-Id: Iaf20ac2175295dee8745c48f8c208a78b84dea91
Signed-off-by: default avatarVamsi Krishna Samavedam <vskrishn@codeaurora.org>
Signed-off-by: default avatarMayank Rana <mrana@codeaurora.org>
parent 6449ed6a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -357,7 +357,7 @@ static void queue_pending_output_urbs(struct snd_usb_endpoint *ep)
		err = usb_submit_urb(ctx->urb, GFP_ATOMIC);
		if (err < 0)
			usb_audio_err(ep->chip,
				"Unable to submit urb #%d: %d (urb %p)\n",
				"Unable to submit urb #%d: %d (urb %pK)\n",
				ctx->index, err, ctx->urb);
		else
			set_bit(ctx->index, &ep->active_mask);
@@ -462,7 +462,7 @@ struct snd_usb_endpoint *snd_usb_add_endpoint(struct snd_usb_audio *chip,
		    ep->iface == alts->desc.bInterfaceNumber &&
		    ep->altsetting == alts->desc.bAlternateSetting) {
			usb_audio_dbg(ep->chip,
				      "Re-using EP %x in iface %d,%d @%p\n",
				      "Re-using EP %x in iface %d,%d @%pK\n",
					ep_num, ep->iface, ep->altsetting, ep);
			goto __exit_unlock;
		}
+6 −6
Original line number Diff line number Diff line
@@ -228,7 +228,7 @@ static int start_endpoints(struct snd_usb_substream *subs)
	if (!test_and_set_bit(SUBSTREAM_FLAG_DATA_EP_STARTED, &subs->flags)) {
		struct snd_usb_endpoint *ep = subs->data_endpoint;

		dev_dbg(&subs->dev->dev, "Starting data EP @%p\n", ep);
		dev_dbg(&subs->dev->dev, "Starting data EP @%pK\n", ep);

		ep->data_subs = subs;
		err = snd_usb_endpoint_start(ep);
@@ -257,7 +257,7 @@ static int start_endpoints(struct snd_usb_substream *subs)
			}
		}

		dev_dbg(&subs->dev->dev, "Starting sync EP @%p\n", ep);
		dev_dbg(&subs->dev->dev, "Starting sync EP @%pK\n", ep);

		ep->sync_slave = subs->data_endpoint;
		err = snd_usb_endpoint_start(ep);
@@ -645,13 +645,13 @@ static int match_endpoint_audioformats(struct snd_usb_substream *subs,

	if (fp->channels < 1) {
		dev_dbg(&subs->dev->dev,
			"%s: (fmt @%p) no channels\n", __func__, fp);
			"%s: (fmt @%pK) no channels\n", __func__, fp);
		return 0;
	}

	if (!(fp->formats & pcm_format_to_bits(pcm_format))) {
		dev_dbg(&subs->dev->dev,
			"%s: (fmt @%p) no match for format %d\n", __func__,
			"%s: (fmt @%pK) no match for format %d\n", __func__,
			fp, pcm_format);
		return 0;
	}
@@ -664,7 +664,7 @@ static int match_endpoint_audioformats(struct snd_usb_substream *subs,
	}
	if (!score) {
		dev_dbg(&subs->dev->dev,
			"%s: (fmt @%p) no match for rate %d\n", __func__,
			"%s: (fmt @%pK) no match for rate %d\n", __func__,
			fp, rate);
		return 0;
	}
@@ -673,7 +673,7 @@ static int match_endpoint_audioformats(struct snd_usb_substream *subs,
		score++;

	dev_dbg(&subs->dev->dev,
		"%s: (fmt @%p) score %d\n", __func__, fp, score);
		"%s: (fmt @%pK) score %d\n", __func__, fp, score);

	return score;
}