All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: Himadri Pandya <himadri18.07@gmail.com>
Cc: Greg KH <gregkh@linuxfoundation.org>, outreachy-kernel@googlegroups.com
Subject: Re: [Outreachy kernel] [PATCH] staging: netlogic: Remove unnecessary error print
Date: Thu, 21 Mar 2019 11:42:59 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.20.1903211141480.5292@hadrien> (raw)
In-Reply-To: <CAPnhUpaXwEBMFa_ukU9uauFuEaUojMju_kG+WHnJ9SQcAXrSpA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3664 bytes --]



On Thu, 21 Mar 2019, Himadri Pandya wrote:

>
>
> On Thu, Mar 21, 2019 at 3:38 PM Julia Lawall <julia.lawall@lip6.fr> wrote:
>
>
>       On Thu, 21 Mar 2019, Himadri Pandya wrote:
>
>       > Kmalloc normally produces a backtrace when there is not enough memory.
>       > So it is unnecessary to print an error message that provides only this
>       > information. Hence, remove pr_error() from memory allocation check.
>       > Issue found using Coccinelle.
>       >
>       > Signed-off-by: Himadri Pandya <himadri18.07@gmail.com>
>       > ---
>       >ᅵ drivers/staging/netlogic/xlr_net.c | 4 +---
>       >ᅵ 1 file changed, 1 insertion(+), 3 deletions(-)
>       >
>       > diff --git a/drivers/staging/netlogic/xlr_net.c b/drivers/staging/netlogic/xlr_net.c
>       > index 8554fcf4321b..afba1248e100 100644
>       > --- a/drivers/staging/netlogic/xlr_net.c
>       > +++ b/drivers/staging/netlogic/xlr_net.c
>       > @@ -389,10 +389,8 @@ static void *xlr_config_spill(struct xlr_net_priv *priv, int reg_start_0,
>       >ᅵ ᅵ ᅵ ᅵbase = priv->base_addr;
>       >ᅵ ᅵ ᅵ ᅵspill_size = size;
>       >ᅵ ᅵ ᅵ ᅵspill = kmalloc(spill_size + SMP_CACHE_BYTES, GFP_ATOMIC);
>       > -ᅵ ᅵ ᅵif (!spill) {
>       > -ᅵ ᅵ ᅵ ᅵ ᅵ ᅵ ᅵpr_err("Unable to allocate memory for spill area!\n");
>       > +ᅵ ᅵ ᅵif (!spill)
>       >ᅵ ᅵ ᅵ ᅵ ᅵ ᅵ ᅵ ᅵreturn ZERO_SIZE_PTR;
>
>       This seems to be the only driver that uses ZERO_SIZE_PTR as the result for
>       kmalloc.ᅵ It could be worth looking into what happens to this value
>       afterwards.
>
>       julia
>
>
> This is interesting. Later the pointer spillᅵis aligned withᅵSMP_CACHE_BYTES (which is defined using L1_CACHE_BYTES).ᅵᅵAs per my understanding,ᅵxlr_config_spill() returns ZERO_SIZE_PTR if kmalloc()ᅵcannot allocate sufficient
> memory(equivalent to spill_size) as the return value is being used to configure network accelerator's communication interface.

The questin is who is checking the return value and whether it is checked
in the right manner.  I looked quickly at the cal site, and it seemed that
the result as stored in a structure field with no checking,  But perhaps
some checking is done afterwards.

julia

>
> Please correct me if I am mistaken.
>
> Thank you.
>
> - Himadri
> ᅵ
>
>       > -ᅵ ᅵ ᅵ}
>       >
>       >ᅵ ᅵ ᅵ ᅵspill = PTR_ALIGN(spill, SMP_CACHE_BYTES);
>       >ᅵ ᅵ ᅵ ᅵphys_addr = virt_to_phys(spill);
>       > --
>       > 2.17.1
>       >
>       > --
>       > You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
>       > To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
>       > To post to this group, send email to outreachy-kernel@googlegroups.com.
>       > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20190321095717.24155-1-himadri18.07%40gmail.com.
>       > For more options, visit https://groups.google.com/d/optout.
>       >
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CAPnhUpaXwEBMFa_ukU9uauFuEaUojMju_kG%2BWHnJ9SQcAXrSpA%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
>

      reply	other threads:[~2019-03-21 10:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-21  9:57 [PATCH] staging: netlogic: Remove unnecessary error print Himadri Pandya
2019-03-21 10:08 ` [Outreachy kernel] " Julia Lawall
2019-03-21 10:40   ` Himadri Pandya
2019-03-21 10:42     ` Julia Lawall [this message]

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=alpine.DEB.2.20.1903211141480.5292@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=gregkh@linuxfoundation.org \
    --cc=himadri18.07@gmail.com \
    --cc=outreachy-kernel@googlegroups.com \
    /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.