Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1479511
| Path | csiph.com!news.mixmin.net!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Kees Cook <keescook@chromium.org> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/2] ramoops: move spin_lock_init after kmalloc error checking |
| Date | Thu, 08 Sep 2016 22:50:02 +0200 |
| Message-ID | <sfeqK-2at-35@gated-at.bofh.it> (permalink) |
| References | <sbQkW-4K2-27@gated-at.bofh.it> |
| X-Original-To | Geliang Tang <geliangtang@gmail.com> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=qEJy2q9DoTX0QFG3l6loPA5dT54gv2PAeU4lnaagf94=; b=KUi5ot7rehpAmDA4Ybt//ggussQLvglvKU6PTyfNXzlFjD+u31Fe8IKpg9UiGxzpre QGAOpDeOXx1i0+gJTePIo4vAGJROJv26GUAA2iCQKPn7V0mPAxk/341wXBtmdOFenWgS 8d+xzwtmaC4je93xtwJp7Mo127JlxwQyjCRKwpIn6uYood0BKYCPskNvhh8qAnWvH1w0 AHuYfGhwFKpE3LpOBX+K2IbDU8d6lBMA6unsijofo9ZhC8Rggqs0CLDi4/qbWZjoayBf XubHyUA4pTV+ehpgly7zHO076s7nrVF4EPievYxiEyH9rxroCVow1kyfuTwjF6C+CFes oT8g== |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=qEJy2q9DoTX0QFG3l6loPA5dT54gv2PAeU4lnaagf94=; b=hGEMW9pJmyeLz6KonLiK7e/id3S7bpWTVHpQvXuKDlcQ42FXm1vXjj/JBxnMYMX9KL XEaiSovU+3i604WXoH6pt9y2l4Y71nsefaZLW3B0uQ3QhYxAz7s+eU2FHFBXrA66Gwez uYphcCYDpY6aUOdNWRyozuISDKtB+NYcAzI8k= |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=qEJy2q9DoTX0QFG3l6loPA5dT54gv2PAeU4lnaagf94=; b=f3CKNvDcn0GnweC5xycTdNOKM6c5edOGoQy2GeZf2Mv3rBuZyWOJpt4XbMeHAf6Wsg YEuE61hcmEvxz8VDhtlLT+Kf3XL4nTaqnuOySSB0ceMQuSJCdulcy6XrFbkCyxmNr5M7 h/2it5bs0HWCdWFqlOb2eqN9TLiFpt/KNEWTfzA2BucgIL2A5C66Q6CzJ0S3QZjxrifM 5EenqcOoS6XuIxBrIT9AzARsK9zhx5qCQcOU7YDvfBNj3FYoVtLV3s86sGeRi/TuKwXp JXBJUZILtbVdkzn901q0tEGSrVvGuk9iKrEIOTn19JNzP7kRhkB6B6au1kMWeirnPO4Q YLeg== |
| X-Gm-Message-State | AE9vXwNYCx18drNdNsXxrLq1+xI/k72ics3rTIupewCIZnyXQt4ZuGKN+IIfHUgqxHp+YFhFlaq3A3i5bYAXDpEU |
| X-Received | by 10.176.81.208 with SMTP id h16mr1355172uaa.94.1473367507402; Thu, 08 Sep 2016 13:45:07 -0700 (PDT) |
| MIME-Version | 1.0 |
| X-Google-Sender-Auth | BugbTU0RYrnE_P6MHlYZc2ttgYs |
| Content-Type | text/plain; charset=UTF-8 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 45 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Anton Vorontsov <anton@enomsg.org>, Colin Cross <ccross@android.com>, Tony Luck <tony.luck@intel.com>, LKML <linux-kernel@vger.kernel.org> |
| X-Original-Date | Thu, 8 Sep 2016 13:45:06 -0700 |
| X-Original-Message-ID | <CAGXu5jLiYWs6X17=v2m70K1egaEFRx5vops-SHB-jw2t+nYwfQ@mail.gmail.com> |
| X-Original-References | <12fb7f17b91d55f53e7aa437e9a25d708a24732c.1472559626.git.geliangtang@gmail.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1479511 |
Show key headers only | View raw
On Tue, Aug 30, 2016 at 5:24 AM, Geliang Tang <geliangtang@gmail.com> wrote:
> If cxt->pstore.buf allocated failed, no need to initialize
> cxt->pstore.buf_lock. So this patch moves spin_lock_init() after the
> error checking.
>
> Signed-off-by: Geliang Tang <geliangtang@gmail.com>
> ---
> fs/pstore/ram.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
> index 7a034d6..ec1c9e5 100644
> --- a/fs/pstore/ram.c
> +++ b/fs/pstore/ram.c
> @@ -608,12 +608,12 @@ static int ramoops_probe(struct platform_device *pdev)
> cxt->pstore.bufsize = 1024; /* LOG_LINE_MAX */
> cxt->pstore.bufsize = max(cxt->record_size, cxt->pstore.bufsize);
> cxt->pstore.buf = kmalloc(cxt->pstore.bufsize, GFP_KERNEL);
> - spin_lock_init(&cxt->pstore.buf_lock);
> if (!cxt->pstore.buf) {
> pr_err("cannot allocate pstore buffer\n");
> err = -ENOMEM;
> goto fail_clear;
> }
> + spin_lock_init(&cxt->pstore.buf_lock);
Seems fine to me. No harm either way, but better to save on the work.
:) Applied for -next.
Thanks!
-Kees
>
> err = pstore_register(&cxt->pstore);
> if (err) {
> --
> 2.7.4
>
--
Kees Cook
Nexus Security
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH 1/2] ramoops: move spin_lock_init after kmalloc error checking Geliang Tang <geliangtang@gmail.com> - 2016-08-30 14:30 +0200 Re: [PATCH 1/2] ramoops: move spin_lock_init after kmalloc error checking Kees Cook <keescook@chromium.org> - 2016-09-08 22:50 +0200
csiph-web