Date: Tue, 6 Nov 2018 22:33:37 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r340206 - head/sys/dev/cxgbe Message-ID: <201811062233.wA6MXbNl032204@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Tue Nov 6 22:33:36 2018 New Revision: 340206 URL: https://svnweb.freebsd.org/changeset/base/340206 Log: Treat the memory lengths for CHELSIO_T4_GET_MEM as unsigned. Previously attempts to read the MC region were failing since the length was greater than 2^31. Reviewed by: np MFC after: 2 months Differential Revision: https://reviews.freebsd.org/D17857 Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Tue Nov 6 21:57:03 2018 (r340205) +++ head/sys/dev/cxgbe/t4_main.c Tue Nov 6 22:33:36 2018 (r340206) @@ -529,9 +529,9 @@ struct intrs_and_queues { static void setup_memwin(struct adapter *); static void position_memwin(struct adapter *, int, uint32_t); -static int validate_mem_range(struct adapter *, uint32_t, int); +static int validate_mem_range(struct adapter *, uint32_t, uint32_t); static int fwmtype_to_hwmtype(int); -static int validate_mt_off_len(struct adapter *, int, uint32_t, int, +static int validate_mt_off_len(struct adapter *, int, uint32_t, uint32_t, uint32_t *); static int fixup_devlog_params(struct adapter *); static int cfg_itype_and_nqueues(struct adapter *, struct intrs_and_queues *); @@ -2826,14 +2826,14 @@ t4_range_cmp(const void *a, const void *b) * the card's address space. */ static int -validate_mem_range(struct adapter *sc, uint32_t addr, int len) +validate_mem_range(struct adapter *sc, uint32_t addr, uint32_t len) { struct t4_range mem_ranges[4], *r, *next; uint32_t em, addr_len; int i, n, remaining; /* Memory can only be accessed in naturally aligned 4 byte units */ - if (addr & 3 || len & 3 || len <= 0) + if (addr & 3 || len & 3 || len == 0) return (EINVAL); /* Enabled memories */ @@ -2972,7 +2972,7 @@ fwmtype_to_hwmtype(int mtype) * the start of the range is returned in addr. */ static int -validate_mt_off_len(struct adapter *sc, int mtype, uint32_t off, int len, +validate_mt_off_len(struct adapter *sc, int mtype, uint32_t off, uint32_t len, uint32_t *addr) { uint32_t em, addr_len, maddr;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201811062233.wA6MXbNl032204>