| Summary: | src/sys/netpfil/ipfw/ip_fw_sockopt.c:304: possible bad size in malloc ? | ||
|---|---|---|---|
| Product: | Base System | Reporter: | David Binderman <dcb314> |
| Component: | kern | Assignee: | Andrey V. Elsukov <ae> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | CC: | ae, markj |
| Priority: | --- | ||
| Version: | CURRENT | ||
| Hardware: | Any | ||
| OS: | Any | ||
The proposed patch looks correct to me, I'll test it a bit later and commit, thanks! A commit references this bug: Author: ae Date: Thu Jul 12 11:38:18 UTC 2018 New revision: 336219 URL: https://svnweb.freebsd.org/changeset/base/336219 Log: Use correct size when we are allocating array for skipto index. Also, there is no need to use M_ZERO for idxmap_back. It will be re-filled just after allocation in update_skipto_cache(). PR: 229665 MFC after: 1 week Changes: head/sys/netpfil/ipfw/ip_fw_sockopt.c A commit references this bug: Author: ae Date: Thu Jul 19 07:30:19 UTC 2018 New revision: 336468 URL: https://svnweb.freebsd.org/changeset/base/336468 Log: MFC r336219: Use correct size when we are allocating array for skipto index. Also, there is no need to use M_ZERO for idxmap_back. It will be re-filled just after allocation in update_skipto_cache(). PR: 229665 Changes: _U stable/11/ stable/11/sys/netpfil/ipfw/ip_fw_sockopt.c Fixed in head/ and stable/11. Thanks! |
src/sys/netpfil/ipfw/ip_fw_sockopt.c:304]: (warning) Size of pointer 'idxmap' used instead of size of its data. Source code is int *idxmap, *idxmap_back; idxmap = malloc(65536 * sizeof(uint32_t *), M_IPFW, M_WAITOK | M_ZERO); idxmap_back = malloc(65536 * sizeof(uint32_t *), M_IPFW, M_WAITOK | M_ZERO); maybe better code int *idxmap, *idxmap_back; idxmap = malloc(65536 * sizeof(int), M_IPFW, M_WAITOK | M_ZERO); idxmap_back = malloc(65536 * sizeof(int), M_IPFW, M_WAITOK | M_ZERO);