linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Chen, Gong" <gong.chen@linux.intel.com>
To: Borislav Petkov <bp@alien8.de>
Cc: tony.luck@intel.com, m.chehab@samsung.com, linux-acpi@vger.kernel.org
Subject: Re: [PATCH 3/7 v4] CPER: Adjust code flow of some functions
Date: Sun, 25 May 2014 22:07:45 -0400	[thread overview]
Message-ID: <20140526020745.GB31035@gchen.bj.intel.com> (raw)
In-Reply-To: <20140523093703.GB21332@pd.tnic>

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

On Fri, May 23, 2014 at 11:37:03AM +0200, Borislav Petkov wrote:
> Date: Fri, 23 May 2014 11:37:03 +0200
> From: Borislav Petkov <bp@alien8.de>
> To: "Chen, Gong" <gong.chen@linux.intel.com>
> Cc: tony.luck@intel.com, m.chehab@samsung.com, linux-acpi@vger.kernel.org
> Subject: Re: [PATCH 3/7 v4] CPER: Adjust code flow of some functions
> User-Agent: Mutt/1.5.23 (2014-03-12)
> 
> On Thu, May 22, 2014 at 09:49:10PM -0400, Chen, Gong wrote:
> > If so, it has been there already. Maybe you should check patch
> > 5/7. I merge pa/pa_mask into pa_info as a whole to avoid too much
> > calculation/logic in trace.
> 
> My bad, how did I miss that:
> 
> > +static void __trace_mem_error(const uuid_le *fru_id, char *fru_text,
> > +                              u64 err_count, u32 severity,
> > +                              struct cper_sec_mem_err *mem)
> > +{
> > +       u32 etype = ~0U;
> > +       char pa_info[64];
> > +       u8 n = 0;
> > +
> > +       if (mem->validation_bits & CPER_MEM_VALID_ERROR_TYPE)
> > +               etype = mem->error_type;
> 
> More SNAFU: mem->error_type is u8 and you're saving it into a u32. What
> possible reason can you have for that?
OK, I will fix it.
> 
> > +
> > +       memset(pa_info, 0, 64);
> > +       if (mem->validation_bits & CPER_MEM_VALID_PA)
> > +               n = snprintf(pa_info, 63, "physical addr: 0x%016llx ",
> > +                            mem->physical_addr);
> > +
> > +       if (mem->validation_bits & CPER_MEM_VALID_PA_MASK)
> > +               snprintf(pa_info + n, 63 - n, "addr LSB: 0x%x ",
> > +                        (u8)__ffs64(mem->physical_addr_mask));
> 
> So pa_info is 64 bytes!!! For what, a u64 and a u8? That's 9 bytes.
> 
Oh, in my subconscious I am always afraid some kind of buffer overflow attach.
You are right, here it is obviously too wasteful. I can shrink it to 10
bytes. Please see my another reply for why I hope to use a string.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2014-05-26 10:10 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-15  8:30 New eMCA trace event interface Chen, Gong
2014-05-15  8:30 ` [PATCH 1/7 v5] trace, RAS: Add basic RAS trace event Chen, Gong
2014-05-15  8:30 ` [PATCH 2/7 v3] trace, AER: Move trace into unified interface Chen, Gong
2014-05-21 10:19   ` Borislav Petkov
2014-05-22  0:03     ` Chen, Gong
2014-05-22 10:41       ` Borislav Petkov
2014-05-15  8:30 ` [PATCH 3/7 v4] CPER: Adjust code flow of some functions Chen, Gong
2014-05-21 11:05   ` Borislav Petkov
2014-05-21 23:51     ` Chen, Gong
2014-05-22 10:52       ` Borislav Petkov
2014-05-23  1:49         ` Chen, Gong
2014-05-23  9:37           ` Borislav Petkov
2014-05-23 10:11             ` Borislav Petkov
2014-05-26  1:59               ` Chen, Gong
2014-05-26 10:21                 ` Borislav Petkov
2014-05-26 10:42                   ` Chen, Gong
2014-05-26  2:07             ` Chen, Gong [this message]
2014-05-26 10:23               ` Borislav Petkov
2014-05-15  8:30 ` [PATCH 4/7 v2] RAS, debugfs: Add debugfs interface for RAS subsystem Chen, Gong
2014-05-15  8:30 ` [PATCH 5/7 v5] trace, RAS: Add eMCA trace event interface Chen, Gong
2014-05-15  8:30 ` [PATCH 6/7 v3] trace, eMCA: Add a knob to adjust where to save event log Chen, Gong
2014-05-21 11:06   ` Borislav Petkov
2014-05-21 23:46     ` Chen, Gong
2014-05-22 11:11       ` Borislav Petkov
2014-05-23  1:40         ` Chen, Gong
2014-05-28  3:27         ` [PATCH 6/7 v4] " Chen, Gong
2014-05-15  8:30 ` [PATCH 7/7] RAS, extlog: Adjust init flow Chen, Gong
2014-05-28  3:32 ` new trace output format Chen, Gong
2014-05-28  3:32   ` [PATCH 5/7 v6] trace, RAS: Add eMCA trace event interface Chen, Gong
2014-05-28 15:28     ` Steven Rostedt
2014-05-28 16:34       ` Borislav Petkov
2014-05-28 16:56         ` Steven Rostedt
2014-05-29  7:43           ` Chen, Gong
2014-05-29 10:35             ` Borislav Petkov
2014-05-29 13:12             ` Steven Rostedt
2014-05-30  2:56               ` Chen, Gong
2014-05-30  9:22           ` Chen, Gong
2014-05-30 10:07             ` Borislav Petkov
2014-05-30 21:16               ` Tony Luck
2014-05-30 21:26                 ` Borislav Petkov
2014-05-30 23:03               ` Luck, Tony
2014-05-31  1:07                 ` Steven Rostedt
2014-06-02 16:22                   ` Luck, Tony
2014-06-02 16:57                     ` Steven Rostedt
2014-06-03  8:36                       ` Chen, Gong
2014-06-03 14:35                         ` Steven Rostedt
2014-06-04 18:32                           ` Steven Rostedt
2014-06-06  6:51                           ` Chen, Gong
2014-06-06 15:21                             ` Steven Rostedt
2014-06-09  1:10                               ` Chen, Gong
2014-06-09 10:22                                 ` Borislav Petkov
2014-05-28 16:23   ` new trace output format Borislav Petkov

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=20140526020745.GB31035@gchen.bj.intel.com \
    --to=gong.chen@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=linux-acpi@vger.kernel.org \
    --cc=m.chehab@samsung.com \
    --cc=tony.luck@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).