Fix typo in wpa_supplicant (#4208)
[librecmc/librecmc.git] / target / linux / brcm63xx / patches-2.6.25 / 110-bcm963xx_fix_cfe_detection.patch
1 From f1a605c36cf1659f5f486ae4135de1e285fdf86c Mon Sep 17 00:00:00 2001
2 From: Axel Gembe <ago@bastart.eu.org>
3 Date: Sat, 17 May 2008 16:17:22 +0200
4 Subject: [PATCH] bcm963xx: fix cfe detection
5
6 The CFE detection failed to account for zero termination.
7
8 Signed-off-by: Axel Gembe <ago@bastart.eu.org>
9 ---
10  drivers/mtd/maps/bcm963xx-flash.c |   11 ++++++-----
11  1 files changed, 6 insertions(+), 5 deletions(-)
12
13 --- a/drivers/mtd/maps/bcm963xx-flash.c
14 +++ b/drivers/mtd/maps/bcm963xx-flash.c
15 @@ -1,8 +1,7 @@
16  /*
17 - * $Id$
18   * Copyright (C) 2006  Florian Fainelli <florian@openwrt.org>
19 - *                     Mike Albon <malbon@openwrt.org>
20 - * Copyright (C) $Date$  $Author$
21 + *                     Mike Albon <malbon@openwrt.org>
22 + * Copyright (C) 2008  Axel Gembe <ago@bastart.eu.org>
23   *
24   * This program is free software; you can redistribute it and/or modify
25   * it under the terms of the GNU General Public License as published by
26 @@ -184,11 +183,13 @@
27  static int bcm963xx_detect_cfe(struct mtd_info *master)
28  {
29         int idoffset = 0x4e0;
30 -       static char idstring[8] = "CFE1CFE1";
31 -       char buf[8];
32 +       static char idstring[9] = "CFE1CFE1";
33 +       char buf[9];
34         int ret;
35         size_t retlen;
36  
37 +       memset(buf, 0, sizeof(buf));
38 +
39         ret = master->read(master, idoffset, 8, &retlen, (void *)buf);
40         printk("bcm963xx: Read Signature value of %s\n", buf);
41         return strcmp(idstring,buf);