Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/nfs In bootpcheck(), make sure we m_pullup() all the of ...
details: https://anonhg.NetBSD.org/src/rev/c02d168931b6
branches: trunk
changeset: 526826:c02d168931b6
user: simonb <simonb%NetBSD.org@localhost>
date: Sun May 12 12:52:58 2002 +0000
description:
In bootpcheck(), make sure we m_pullup() all the of bootp header that we
actually examine.
While here, toss out home-grown ofs() macro and use offsetof().
diffstat:
sys/nfs/nfs_bootdhcp.c | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
diffs (34 lines):
diff -r c8099b29dd0a -r c02d168931b6 sys/nfs/nfs_bootdhcp.c
--- a/sys/nfs/nfs_bootdhcp.c Sun May 12 12:30:10 2002 +0000
+++ b/sys/nfs/nfs_bootdhcp.c Sun May 12 12:52:58 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nfs_bootdhcp.c,v 1.19 2002/03/20 23:07:37 thorpej Exp $ */
+/* $NetBSD: nfs_bootdhcp.c,v 1.20 2002/05/12 12:52:58 simonb Exp $ */
/*-
* Copyright (c) 1995, 1997 The NetBSD Foundation, Inc.
@@ -51,7 +51,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_bootdhcp.c,v 1.19 2002/03/20 23:07:37 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_bootdhcp.c,v 1.20 2002/05/12 12:52:58 simonb Exp $");
#include "opt_nfs_boot.h"
@@ -341,13 +341,11 @@
/*
* don't make first checks more expensive than necessary
*/
-#define ofs(what, elem) ((int)&(((what *)0)->elem))
- if (m->m_len < ofs(struct bootp, bp_secs)) {
- m = m_pullup(m, ofs(struct bootp, bp_secs));
+ if (m->m_len < offsetof(struct bootp, bp_sname)) {
+ m = m_pullup(m, offsetof(struct bootp, bp_sname));
if (m == NULL)
return (-1);
}
-#undef ofs
bootp = mtod(m, struct bootp*);
if (bootp->bp_op != BOOTREPLY) {
Home |
Main Index |
Thread Index |
Old Index