lkml.org 
[lkml]   [2011]   [Nov]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch] edac: sb_edac: add sanity check to silence static checker


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;
> /*


\
 
 \ /
  Last update: 2011-11-01 13:43    [W:0.035 / U:5.788 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site