Sat Jan 30 11:34:28 2021 UTC ()
Fix "Cannot allocate memory" failure on amd64.

BIOCGBLEN ioctl of bpf(4) requires u_int, not size_t.
The problem is reported by Kenji Aoyama.

Should be pulled up to netbsd-9 and netbsd-8.


(tsutsui)
diff -r1.3 -r1.4 src/usr.sbin/isibootd/isibootd.c

cvs diff -r1.3 -r1.4 src/usr.sbin/isibootd/isibootd.c (expand / switch to unified diff)

--- src/usr.sbin/isibootd/isibootd.c 2012/04/02 09:01:30 1.3
+++ src/usr.sbin/isibootd/isibootd.c 2021/01/30 11:34:28 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: isibootd.c,v 1.3 2012/04/02 09:01:30 nisimura Exp $ */ 1/* $NetBSD: isibootd.c,v 1.4 2021/01/30 11:34:28 tsutsui Exp $ */
2/* Id: isiboot.c,v 1.2 1999/12/26 14:33:33 nisimura Exp */ 2/* Id: isiboot.c,v 1.2 1999/12/26 14:33:33 nisimura Exp */
3 3
4/*- 4/*-
5 * Copyright (c) 2000, 2011 The NetBSD Foundation, Inc. 5 * Copyright (c) 2000, 2011 The NetBSD Foundation, Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * This code is derived from software contributed to The NetBSD Foundation 8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Tohru Nishimura. 9 * by Tohru Nishimura.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -354,27 +354,27 @@ static struct bpf_insn bpf_insn[] = { @@ -354,27 +354,27 @@ static struct bpf_insn bpf_insn[] = {
354}; 354};
355static struct bpf_program bpf_pgm = { 355static struct bpf_program bpf_pgm = {
356 sizeof(bpf_insn) / sizeof(bpf_insn[0]), 356 sizeof(bpf_insn) / sizeof(bpf_insn[0]),
357 bpf_insn 357 bpf_insn
358}; 358};
359 359
360void 360void
361createbpfport(char *ifname, uint8_t **iobufp, size_t *iolenp, 361createbpfport(char *ifname, uint8_t **iobufp, size_t *iolenp,
362 struct station *st) 362 struct station *st)
363{ 363{
364 struct ifreq ifr; 364 struct ifreq ifr;
365 int fd; 365 int fd;
366 u_int type; 366 u_int type;
367 size_t buflen; 367 u_int buflen;
368 uint8_t dladdr[ETHER_ADDR_LEN], *buf; 368 uint8_t dladdr[ETHER_ADDR_LEN], *buf;
369#ifdef BIOCIMMEDIATE 369#ifdef BIOCIMMEDIATE
370 u_int flag; 370 u_int flag;
371#endif 371#endif
372#ifndef _PATH_BPF 372#ifndef _PATH_BPF
373 char devbpf[PATH_MAX]; 373 char devbpf[PATH_MAX];
374 int n; 374 int n;
375#endif 375#endif
376 376
377#ifdef _PATH_BPF 377#ifdef _PATH_BPF
378 fd = open(_PATH_BPF, O_RDWR, 0); 378 fd = open(_PATH_BPF, O_RDWR, 0);
379#else 379#else
380 n = 0; 380 n = 0;