Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic correct pointer arithmetics



details:   https://anonhg.NetBSD.org/src/rev/22373b51918f
branches:  trunk
changeset: 1004169:22373b51918f
user:      tnn <tnn%NetBSD.org@localhost>
date:      Tue Oct 15 17:19:05 2019 +0000

description:
correct pointer arithmetics

diffstat:

 sys/dev/ic/dwc_gmac.c |  9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diffs (37 lines):

diff -r f41ad07c04de -r 22373b51918f sys/dev/ic/dwc_gmac.c
--- a/sys/dev/ic/dwc_gmac.c     Tue Oct 15 16:59:15 2019 +0000
+++ b/sys/dev/ic/dwc_gmac.c     Tue Oct 15 17:19:05 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_gmac.c,v 1.66 2019/10/15 16:30:49 tnn Exp $ */
+/* $NetBSD: dwc_gmac.c,v 1.67 2019/10/15 17:19:05 tnn Exp $ */
 
 /*-
  * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.66 2019/10/15 16:30:49 tnn Exp $");
+__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.67 2019/10/15 17:19:05 tnn Exp $");
 
 /* #define     DWC_GMAC_DEBUG  1 */
 
@@ -501,8 +501,7 @@
                }
                data->rd_m->m_len = data->rd_m->m_pkthdr.len
                    = data->rd_m->m_ext.ext_size;
-               m_adj(data->rd_m,
-                   roundup((uintptr_t)data->rd_m->m_data & 0x3f, 0x40));
+               m_adj(data->rd_m, (-(uintptr_t)data->rd_m->m_data) & 0x3f);
                if (data->rd_m->m_len > AWGE_MAX_PACKET) {
                        data->rd_m->m_len = data->rd_m->m_pkthdr.len
                            = AWGE_MAX_PACKET;
@@ -1276,7 +1275,7 @@
                        goto skip;
                }
                mnew->m_len = mnew->m_pkthdr.len = mnew->m_ext.ext_size;
-               m_adj(mnew, roundup((uintptr_t)mnew->m_data & 0x3f, 0x40));
+               m_adj(mnew, (-(uintptr_t)mnew->m_data) & 0x3f);
                if (mnew->m_len > AWGE_MAX_PACKET) {
                        mnew->m_len = mnew->m_pkthdr.len = AWGE_MAX_PACKET;
                }



Home | Main Index | Thread Index | Old Index