From: Dan Carpenter <dan.carpenter@oracle.com>
To: Rob Clark <robdclark@gmail.com>
Cc: dri-devel <dri-devel@lists.freedesktop.org>,
freedreno <freedreno@lists.freedesktop.org>,
linux-arm-msm <linux-arm-msm@vger.kernel.org>,
Rob Clark <robdclark@chromium.org>, Sean Paul <sean@poorly.run>,
Abhinav Kumar <quic_abhinavk@quicinc.com>,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
Akhil P Oommen <quic_akhilpo@quicinc.com>,
Jonathan Marek <jonathan@marek.ca>,
Jordan Crouse <jordan@cosmicpenguin.net>,
Emma Anholt <emma@anholt.net>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/3] drm/msm: Add a way to override processes comm/cmdline
Date: Fri, 18 Mar 2022 10:18:43 +0300 [thread overview]
Message-ID: <20220318071843.GF336@kadam> (raw)
In-Reply-To: <CAF6AEGsnXz05fCnYAvFk+Hp-2z7N1kdVS0kYKn7+ejohLp8H7w@mail.gmail.com>
On Thu, Mar 17, 2022 at 08:03:59AM -0700, Rob Clark wrote:
> > > diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
> > > index 4ec62b601adc..68f3f8ade76d 100644
> > > --- a/drivers/gpu/drm/msm/msm_gpu.c
> > > +++ b/drivers/gpu/drm/msm/msm_gpu.c
> > > @@ -364,14 +364,21 @@ static void retire_submits(struct msm_gpu *gpu);
> > >
> > > static void get_comm_cmdline(struct msm_gem_submit *submit, char **comm, char **cmd)
> > > {
> > > + struct msm_file_private *ctx = submit->queue->ctx;
> > > struct task_struct *task;
> > >
> > > + *comm = kstrdup(ctx->comm, GFP_KERNEL);
> > > + *cmd = kstrdup(ctx->cmdline, GFP_KERNEL);
> > > +
> > > task = get_pid_task(submit->pid, PIDTYPE_PID);
> > > if (!task)
> > > return;
> > >
> > > - *comm = kstrdup(task->comm, GFP_KERNEL);
> > > - *cmd = kstrdup_quotable_cmdline(task, GFP_KERNEL);
> > > + if (!*comm)
> > > + *comm = kstrdup(task->comm, GFP_KERNEL);
> >
> > What?
> >
> > If the first allocation failed, then this one is going to fail as well.
> > Just return -ENOMEM. Or maybe this is meant to be checking for an empty
> > string?
>
> fwiw, if ctx->comm is NULL, the kstrdup() will return NULL, so this
> isn't intended to deal with OoM, but the case that comm and/or cmdline
> is not overridden.
Ah, I should have thought about that. Thanks!
regards,
dan carpenter
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Rob Clark <robdclark@gmail.com>
Cc: Rob Clark <robdclark@chromium.org>,
freedreno <freedreno@lists.freedesktop.org>,
Emma Anholt <emma@anholt.net>, Jonathan Marek <jonathan@marek.ca>,
David Airlie <airlied@linux.ie>,
linux-arm-msm <linux-arm-msm@vger.kernel.org>,
Abhinav Kumar <quic_abhinavk@quicinc.com>,
dri-devel <dri-devel@lists.freedesktop.org>,
Jordan Crouse <jordan@cosmicpenguin.net>,
Akhil P Oommen <quic_akhilpo@quicinc.com>,
Sean Paul <sean@poorly.run>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/3] drm/msm: Add a way to override processes comm/cmdline
Date: Fri, 18 Mar 2022 10:18:43 +0300 [thread overview]
Message-ID: <20220318071843.GF336@kadam> (raw)
In-Reply-To: <CAF6AEGsnXz05fCnYAvFk+Hp-2z7N1kdVS0kYKn7+ejohLp8H7w@mail.gmail.com>
On Thu, Mar 17, 2022 at 08:03:59AM -0700, Rob Clark wrote:
> > > diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
> > > index 4ec62b601adc..68f3f8ade76d 100644
> > > --- a/drivers/gpu/drm/msm/msm_gpu.c
> > > +++ b/drivers/gpu/drm/msm/msm_gpu.c
> > > @@ -364,14 +364,21 @@ static void retire_submits(struct msm_gpu *gpu);
> > >
> > > static void get_comm_cmdline(struct msm_gem_submit *submit, char **comm, char **cmd)
> > > {
> > > + struct msm_file_private *ctx = submit->queue->ctx;
> > > struct task_struct *task;
> > >
> > > + *comm = kstrdup(ctx->comm, GFP_KERNEL);
> > > + *cmd = kstrdup(ctx->cmdline, GFP_KERNEL);
> > > +
> > > task = get_pid_task(submit->pid, PIDTYPE_PID);
> > > if (!task)
> > > return;
> > >
> > > - *comm = kstrdup(task->comm, GFP_KERNEL);
> > > - *cmd = kstrdup_quotable_cmdline(task, GFP_KERNEL);
> > > + if (!*comm)
> > > + *comm = kstrdup(task->comm, GFP_KERNEL);
> >
> > What?
> >
> > If the first allocation failed, then this one is going to fail as well.
> > Just return -ENOMEM. Or maybe this is meant to be checking for an empty
> > string?
>
> fwiw, if ctx->comm is NULL, the kstrdup() will return NULL, so this
> isn't intended to deal with OoM, but the case that comm and/or cmdline
> is not overridden.
Ah, I should have thought about that. Thanks!
regards,
dan carpenter
next prev parent reply other threads:[~2022-03-18 7:19 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-17 0:29 [PATCH 0/3] drm/msm: Add comm/cmdline override Rob Clark
2022-03-17 0:29 ` Rob Clark
2022-03-17 0:29 ` [PATCH 1/3] drm/msm: Add support for pointer params Rob Clark
2022-03-17 0:29 ` Rob Clark
2022-03-17 0:29 ` [PATCH 2/3] drm/msm: Split out helper to get comm/cmdline Rob Clark
2022-03-17 0:29 ` Rob Clark
2022-03-17 0:29 ` [PATCH 3/3] drm/msm: Add a way to override processes comm/cmdline Rob Clark
2022-03-17 0:29 ` Rob Clark
2022-03-17 8:21 ` Dan Carpenter
2022-03-17 8:21 ` Dan Carpenter
2022-03-17 15:03 ` Rob Clark
2022-03-17 15:03 ` Rob Clark
2022-03-18 7:18 ` Dan Carpenter [this message]
2022-03-18 7:18 ` Dan Carpenter
2022-03-18 15:06 ` Rob Clark
2022-03-18 15:06 ` Rob Clark
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220318071843.GF336@kadam \
--to=dan.carpenter@oracle.com \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=emma@anholt.net \
--cc=freedreno@lists.freedesktop.org \
--cc=jonathan@marek.ca \
--cc=jordan@cosmicpenguin.net \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=quic_abhinavk@quicinc.com \
--cc=quic_akhilpo@quicinc.com \
--cc=robdclark@chromium.org \
--cc=robdclark@gmail.com \
--cc=sean@poorly.run \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.