mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>, linux-media@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org,
	syzbot+6bed2d543cf7e48b822b@syzkaller.appspotmail.com,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Sakari Ailus <sakari.ailus@linux.intel.com>
Subject: Re: [PATCH] media: media-request: Fix crash according to a failed memory allocation
Date: Sun, 21 Jun 2020 14:45:10 +0200	[thread overview]
Message-ID: <b39653f6-9587-4027-35ed-53d341845cb2@web.de> (raw)

> …, reorder media_request_alloc() such that …

Wording adjustments:
…, reorder statements in the implementation of the function “media_request_alloc” so that …


> … the last step thus

… the last step.
Thus media_request_close() …


Would you like to add the tag “Fixes” to the commit message?


…
> +++ b/drivers/media/mc/mc-request.c
> @@ -296,9 +296,18 @@ int media_request_alloc(struct media_device *mdev, int *alloc_fd)
>  	if (WARN_ON(!mdev->ops->req_alloc ^ !mdev->ops->req_free))
>  		return -ENOMEM;
>
> +	if (mdev->ops->req_alloc)
> +		req = mdev->ops->req_alloc(mdev);
> +	else
> +		req = kzalloc(sizeof(*req), GFP_KERNEL);

How do you think about to use a conditional operator?

+	req = (mdev->ops->req_alloc
	       ? mdev->ops->req_alloc(mdev)
	       : kzalloc(sizeof(*req), GFP_KERNEL));


Regards,
Markus

             reply	other threads:[~2020-06-21 12:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-21 12:45 Markus Elfring [this message]
2020-06-21 13:55 ` Greg KH

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=b39653f6-9587-4027-35ed-53d341845cb2@web.de \
    --to=markus.elfring@web.de \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=stable@vger.kernel.org \
    --cc=syzbot+6bed2d543cf7e48b822b@syzkaller.appspotmail.com \
    --cc=tuomas.tynkkynen@iki.fi \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®