android_kernel_lge_bullhead/drivers/net/wan
Arnd Bergmann 4d882b64d6 farsync: fix off-by-one bug in fst_add_one
commit e725a66c0202b5f36c2f9d59d26a65c53bbf21f7 upstream.

gcc-6 finds an out of bounds access in the fst_add_one function
when calculating the end of the mmio area:

drivers/net/wan/farsync.c: In function 'fst_add_one':
drivers/net/wan/farsync.c:418:53: error: index 2 denotes an offset greater than size of 'u8[2][8192] {aka unsigned char[2][8192]}' [-Werror=array-bounds]
 #define BUF_OFFSET(X)   (BFM_BASE + offsetof(struct buf_window, X))
                                                     ^
include/linux/compiler-gcc.h:158:21: note: in definition of macro '__compiler_offsetof'
  __builtin_offsetof(a, b)
                     ^
drivers/net/wan/farsync.c:418:37: note: in expansion of macro 'offsetof'
 #define BUF_OFFSET(X)   (BFM_BASE + offsetof(struct buf_window, X))
                                     ^~~~~~~~
drivers/net/wan/farsync.c:2519:36: note: in expansion of macro 'BUF_OFFSET'
                                  + BUF_OFFSET ( txBuffer[i][NUM_TX_BUFFER][0]);
                                    ^~~~~~~~~~

The warning is correct, but not critical because this appears
to be a write-only variable that is set by each WAN driver but
never accessed afterwards.

I'm taking the minimal fix here, using the correct pointer by
pointing 'mem_end' to the last byte inside of the register area
as all other WAN drivers do, rather than the first byte outside of
it. An alternative would be to just remove the mem_end member
entirely.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>
2016-06-07 10:42:49 +02:00
..
lmc drivers/net: fix up function prototypes after __dev* removals 2012-12-07 14:22:22 -05:00
.gitignore
Kconfig tty/serial patches for 3.9-rc1 2013-02-21 13:41:04 -08:00
Makefile wanrouter: completely decouple obsolete code from kernel. 2013-01-31 19:20:33 -05:00
c101.c drivers/net: Remove unnecessary k.alloc/v.alloc OOM messages 2012-01-31 16:20:21 -05:00
cosa.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-02-26 20:16:07 -08:00
cosa.h
dlci.c dlci: validate the net device in dlci_del() 2013-06-26 15:36:42 -07:00
dscc4.c drivers/net: fix up function prototypes after __dev* removals 2012-12-07 14:22:22 -05:00
farsync.c farsync: fix off-by-one bug in fst_add_one 2016-06-07 10:42:49 +02:00
farsync.h
hd64570.c drivers/net: fix up function prototypes after __dev* removals 2012-12-07 14:22:22 -05:00
hd64570.h
hd64572.c drivers/net: fix up function prototypes after __dev* removals 2012-12-07 14:22:22 -05:00
hd64572.h
hdlc.c wan: Remove unnecessary alloc/OOM messages 2013-02-04 13:22:34 -05:00
hdlc_cisco.c generic_hdlc: Update to current logging forms 2011-06-27 00:09:46 -07:00
hdlc_fr.c net: replace random_ether_addr() with eth_hw_addr_random() 2012-02-15 15:34:16 -05:00
hdlc_ppp.c net/wan/hdlc_ppp: use break in switch 2011-08-22 11:30:38 -07:00
hdlc_raw.c
hdlc_raw_eth.c net: replace random_ether_addr() with eth_hw_addr_random() 2012-02-15 15:34:16 -05:00
hdlc_x25.c wan: make LAPB callbacks const 2011-09-16 19:20:20 -04:00
hostess_sv11.c wan: Update to current logging forms 2011-06-27 00:09:47 -07:00
ixp4xx_hss.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2012-12-12 18:07:07 -08:00
lapbether.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
n2.c drivers/net: Remove unnecessary k.alloc/v.alloc OOM messages 2012-01-31 16:20:21 -05:00
pc300too.c drivers/net: fix up function prototypes after __dev* removals 2012-12-07 14:22:22 -05:00
pci200syn.c drivers/net: fix up function prototypes after __dev* removals 2012-12-07 14:22:22 -05:00
sbni.c module_param: make bool parameters really bool (net & drivers/net) 2011-12-19 22:27:29 -05:00
sbni.h
sdla.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
sealevel.c module_param: make bool parameters really bool (net & drivers/net) 2011-12-19 22:27:29 -05:00
wanxl.c wanxl: fix info leak in ioctl 2013-11-04 04:31:04 -08:00
wanxl.h
wanxlfw.S Fix the wanxl firmware to include missing constants 2012-11-09 16:28:37 -05:00
wanxlfw.inc_shipped
x25_asy.c wan/x25: Fix use-after-free in x25_asy_open_tty() 2016-02-25 11:57:46 -08:00
x25_asy.h
z85230.c sections: fix section conflicts in drivers/net/wan 2012-10-06 03:04:43 +09:00
z85230.h