From: walter harms <wharms@bfs.de>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Mauro Carvalho Chehab <mchehab@redhat.com>,
"Mark A. Grondona" <mgrondona@llnl.gov>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] edac: sb_edac: add sanity check to silence static checker
Date: Tue, 01 Nov 2011 13:32:31 +0100 [thread overview]
Message-ID: <4EAFE6DF.8030403@bfs.de> (raw)
In-Reply-To: <20111101062852.GA19020@elgon.mountain>
Am 01.11.2011 07:28, schrieb Dan Carpenter:
> I assume the the check on if (limit <= prv) prevents n_tads from
> actually reaching MAX_TAD. The problem with that is that it relies
> on the hardware returning the right value and Smatch complains that
> if it doesn't we could have a buffer overflow.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> Feel free to ignore this patch if you want. I don't have very stong
> feelings about this either way.
>
> diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c
> index 7a402bf..ebf386c 100644
> --- a/drivers/edac/sb_edac.c
> +++ b/drivers/edac/sb_edac.c
> @@ -970,6 +970,12 @@ static int get_memory_error_data(struct mem_ctl_info *mci,
> break;
> prv = limit;
> }
> + if (n_tads == MAX_TAD) {
> + sprintf(msg, "Could not discover the memory channel");
why the sprintf() ? can you not simply:
edac_mc_handle_ce_no_info(mci,"Could not discover the memory channel");
re,
wh
> + edac_mc_handle_ce_no_info(mci, msg);
> + return -EINVAL;
> + }
> +
> ch_way = TAD_CH(reg) + 1;
> sck_way = TAD_SOCK(reg) + 1;
> /*
next prev parent reply other threads:[~2011-11-01 12:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-01 6:28 [patch] edac: sb_edac: add sanity check to silence static checker Dan Carpenter
2011-11-01 12:32 ` walter harms [this message]
2011-11-01 12:53 ` Mauro Carvalho Chehab
2011-11-01 13:59 ` Dan Carpenter
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=4EAFE6DF.8030403@bfs.de \
--to=wharms@bfs.de \
--cc=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab@redhat.com \
--cc=mgrondona@llnl.gov \
/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