sync with OpenBSD -current

This commit is contained in:
purplerain 2024-06-26 04:27:03 +00:00
parent fdb8624c1a
commit 7f3136b31c
Signed by: purplerain
GPG Key ID: F42C07F07E2E35B7
43 changed files with 307 additions and 186 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.81 2023/11/22 15:55:28 tb Exp $
# $OpenBSD: Makefile,v 1.82 2024/06/25 14:10:45 jsing Exp $
.include <bsd.own.mk>
.ifndef NOMAN
@ -23,6 +23,7 @@ CFLAGS+= -DLIBRESSL_NAMESPACE
CFLAGS+= -DTLS13_DEBUG
.endif
CFLAGS+= -I${.CURDIR}
CFLAGS+= -I${.CURDIR}/../libcrypto
CFLAGS+= -I${.CURDIR}/../libcrypto/hidden
CFLAGS+= -I${.CURDIR}/../libcrypto/bio
CFLAGS+= -I${.CURDIR}/hidden

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ssl_local.h,v 1.16 2024/05/19 07:12:50 jsg Exp $ */
/* $OpenBSD: ssl_local.h,v 1.17 2024/06/25 14:10:45 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -167,8 +167,10 @@
__BEGIN_HIDDEN_DECLS
#ifndef CTASSERT
#define CTASSERT(x) extern char _ctassert[(x) ? 1 : -1 ] \
__attribute__((__unused__))
#endif
#ifndef LIBRESSL_HAS_DTLS1_2
#define LIBRESSL_HAS_DTLS1_2

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ssl_srvr.c,v 1.160 2024/02/03 17:39:17 tb Exp $ */
/* $OpenBSD: ssl_srvr.c,v 1.161 2024/06/25 14:10:45 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -163,6 +163,7 @@
#include <openssl/x509.h>
#include "bytestring.h"
#include "crypto_internal.h"
#include "dtls_local.h"
#include "ssl_local.h"
#include "ssl_sigalgs.h"
@ -1621,98 +1622,104 @@ ssl3_send_certificate_request(SSL *s)
static int
ssl3_get_client_kex_rsa(SSL *s, CBS *cbs)
{
unsigned char fakekey[SSL_MAX_MASTER_KEY_LENGTH];
unsigned char *pms = NULL;
unsigned char *p;
uint8_t fakepms[SSL_MAX_MASTER_KEY_LENGTH];
uint8_t *pms = NULL;
size_t pms_len = 0;
size_t pad_len;
EVP_PKEY *pkey = NULL;
RSA *rsa = NULL;
CBS enc_pms;
int decrypt_len;
int al = -1;
uint8_t mask;
size_t i;
int valid = 1;
int ret = 0;
arc4random_buf(fakekey, sizeof(fakekey));
/*
* Handle key exchange in the form of an RSA-Encrypted Premaster Secret
* Message. See RFC 5246, section 7.4.7.1.
*/
fakekey[0] = s->s3->hs.peer_legacy_version >> 8;
fakekey[1] = s->s3->hs.peer_legacy_version & 0xff;
arc4random_buf(fakepms, sizeof(fakepms));
fakepms[0] = s->s3->hs.peer_legacy_version >> 8;
fakepms[1] = s->s3->hs.peer_legacy_version & 0xff;
pkey = s->cert->pkeys[SSL_PKEY_RSA].privatekey;
if (pkey == NULL || (rsa = EVP_PKEY_get0_RSA(pkey)) == NULL) {
al = SSL_AD_HANDSHAKE_FAILURE;
SSLerror(s, SSL_R_MISSING_RSA_CERTIFICATE);
goto fatal_err;
ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE);
goto err;
}
/*
* The minimum size of an encrypted premaster secret is 11 bytes of
* padding (00 02 <8 or more non-zero bytes> 00) (RFC 8017, section
* 9.2) and 48 bytes of premaster secret (RFC 5246, section 7.4.7.1).
* This means an RSA key size of at least 472 bits.
*/
pms_len = RSA_size(rsa);
if (pms_len < SSL_MAX_MASTER_KEY_LENGTH)
goto err;
if ((pms = malloc(pms_len)) == NULL)
goto err;
p = pms;
if (!CBS_get_u16_length_prefixed(cbs, &enc_pms))
goto decode_err;
if (CBS_len(cbs) != 0 || CBS_len(&enc_pms) != RSA_size(rsa)) {
SSLerror(s, SSL_R_TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG);
if (pms_len < 11 + SSL_MAX_MASTER_KEY_LENGTH) {
SSLerror(s, SSL_R_DECRYPTION_FAILED);
ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_DECRYPT_ERROR);
goto err;
}
pad_len = pms_len - SSL_MAX_MASTER_KEY_LENGTH;
if (!CBS_get_u16_length_prefixed(cbs, &enc_pms)) {
SSLerror(s, SSL_R_BAD_PACKET_LENGTH);
ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_DECODE_ERROR);
goto err;
}
if (CBS_len(&enc_pms) != pms_len || CBS_len(cbs) != 0) {
SSLerror(s, SSL_R_TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG);
ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_DECODE_ERROR);
goto err;
}
if ((pms = calloc(1, pms_len)) == NULL)
goto err;
decrypt_len = RSA_private_decrypt(CBS_len(&enc_pms), CBS_data(&enc_pms),
pms, rsa, RSA_PKCS1_PADDING);
pms, rsa, RSA_NO_PADDING);
ERR_clear_error();
if (decrypt_len != SSL_MAX_MASTER_KEY_LENGTH) {
al = SSL_AD_DECODE_ERROR;
/* SSLerror(s, SSL_R_BAD_RSA_DECRYPT); */
if (decrypt_len != pms_len) {
SSLerror(s, SSL_R_DECRYPTION_FAILED);
ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_DECRYPT_ERROR);
goto err;
}
if ((al == -1) && !((pms[0] == (s->s3->hs.peer_legacy_version >> 8)) &&
(pms[1] == (s->s3->hs.peer_legacy_version & 0xff)))) {
/*
* The premaster secret must contain the same version number
* as the ClientHello to detect version rollback attacks
* (strangely, the protocol does not offer such protection for
* DH ciphersuites).
*
* The Klima-Pokorny-Rosa extension of Bleichenbacher's attack
* (http://eprint.iacr.org/2003/052/) exploits the version
* number check as a "bad version oracle" -- an alert would
* reveal that the plaintext corresponding to some ciphertext
* made up by the adversary is properly formatted except that
* the version number is wrong. To avoid such attacks, we should
* treat this just like any other decryption error.
* All processing from here on needs to avoid leaking any information
* about the decrypted content, in order to prevent oracle attacks and
* minimise timing attacks.
*/
al = SSL_AD_DECODE_ERROR;
/* SSLerror(s, SSL_R_BAD_PROTOCOL_VERSION_NUMBER); */
}
if (al != -1) {
/*
* Some decryption failure -- use random value instead
* as countermeasure against Bleichenbacher's attack
* on PKCS #1 v1.5 RSA padding (see RFC 2246,
* section 7.4.7.1).
*/
p = fakekey;
}
/* Check padding - 00 02 <8 or more non-zero bytes> 00 */
valid &= crypto_ct_eq_u8(pms[0], 0x00);
valid &= crypto_ct_eq_u8(pms[1], 0x02);
for (i = 2; i < pad_len - 1; i++)
valid &= crypto_ct_ne_u8(pms[i], 0x00);
valid &= crypto_ct_eq_u8(pms[pad_len - 1], 0x00);
if (!tls12_derive_master_secret(s, p, SSL_MAX_MASTER_KEY_LENGTH))
/* Ensure client version in premaster secret matches ClientHello version. */
valid &= crypto_ct_eq_u8(pms[pad_len + 0], s->s3->hs.peer_legacy_version >> 8);
valid &= crypto_ct_eq_u8(pms[pad_len + 1], s->s3->hs.peer_legacy_version & 0xff);
/* Use the premaster secret if padding is correct, if not use the fake. */
mask = crypto_ct_eq_mask_u8(valid, 1);
for (i = 0; i < SSL_MAX_MASTER_KEY_LENGTH; i++)
pms[i] = (pms[pad_len + i] & mask) | (fakepms[i] & ~mask);
if (!tls12_derive_master_secret(s, pms, SSL_MAX_MASTER_KEY_LENGTH))
goto err;
freezero(pms, pms_len);
ret = 1;
return 1;
decode_err:
al = SSL_AD_DECODE_ERROR;
SSLerror(s, SSL_R_BAD_PACKET_LENGTH);
fatal_err:
ssl3_send_alert(s, SSL3_AL_FATAL, al);
err:
freezero(pms, pms_len);
return 0;
return ret;
}
static int

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ssl_tlsext.c,v 1.150 2024/06/06 16:13:12 tb Exp $ */
/* $OpenBSD: ssl_tlsext.c,v 1.151 2024/06/25 05:46:48 tb Exp $ */
/*
* Copyright (c) 2016, 2017, 2019 Joel Sing <jsing@openbsd.org>
* Copyright (c) 2017 Doug Hogan <doug@openbsd.org>
@ -2427,7 +2427,7 @@ tlsext_randomize_build_order(SSL *s)
s->tlsext_build_order[N_TLS_EXTENSIONS - 1] = psk_ext;
/* Fisher-Yates shuffle with PSK fixed. */
for (idx = 0; idx < psk_idx; idx++) {
for (idx = 0; idx < N_TLS_EXTENSIONS - 1; idx++) {
new_idx = arc4random_uniform(idx + 1);
s->tlsext_build_order[idx] = s->tlsext_build_order[new_idx];
s->tlsext_build_order[new_idx] = &tls_extensions[idx];

View File

@ -1,4 +1,4 @@
/* $OpenBSD: intr.c,v 1.60 2024/06/15 18:01:44 kettenis Exp $ */
/* $OpenBSD: intr.c,v 1.61 2024/06/25 12:02:48 kettenis Exp $ */
/* $NetBSD: intr.c,v 1.3 2003/03/03 22:16:20 fvdl Exp $ */
/*
@ -74,6 +74,7 @@ struct pic softintr_pic = {
};
int intr_suspended;
struct intrhand *intr_nowake;
/*
* Fill in default interrupt table (in case of spurious interrupt
@ -537,8 +538,10 @@ intr_handler(struct intrframe *frame, struct intrhand *ih)
* We may not be able to mask MSIs, so block non-wakeup
* interrupts while we're suspended.
*/
if (intr_suspended && (ih->ih_flags & IPL_WAKEUP) == 0)
if (intr_suspended && (ih->ih_flags & IPL_WAKEUP) == 0) {
intr_nowake = ih;
return 0;
}
#ifdef MULTIPROCESSOR
if (ih->ih_flags & IPL_MPSAFE)
@ -749,6 +752,13 @@ intr_disable_wakeup(void)
if (pic->pic_hwunmask)
pic->pic_hwunmask(pic, pin);
}
if (intr_nowake) {
printf("last non-wakeup interrupt: irq%d/%s\n",
*(int *)intr_nowake->ih_count.ec_data,
intr_nowake->ih_count.ec_name);
intr_nowake = NULL;
}
}
#endif

View File

@ -1,4 +1,4 @@
/* $OpenBSD: machdep.c,v 1.294 2024/06/07 16:53:35 kettenis Exp $ */
/* $OpenBSD: machdep.c,v 1.295 2024/06/26 01:40:49 jsg Exp $ */
/* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */
/*-
@ -1294,7 +1294,8 @@ set_sys_segment(struct sys_segment_descriptor *sd, void *base, size_t limit,
sd->sd_hibase = (u_int64_t)base >> 24;
}
void cpu_init_idt(void)
void
cpu_init_idt(void)
{
struct region_descriptor region;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: vmm_machdep.c,v 1.27 2024/05/13 01:15:50 jsg Exp $ */
/* $OpenBSD: vmm_machdep.c,v 1.28 2024/06/26 01:40:49 jsg Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
@ -8370,7 +8370,8 @@ vmm_decode_perf_status_value(uint64_t val)
DPRINTF("(pstate ratio = 0x%llx)\n", (val & 0xffff));
}
void vmm_decode_perf_ctl_value(uint64_t val)
void
vmm_decode_perf_ctl_value(uint64_t val)
{
DPRINTF("(%s ", (val & PERF_CTL_TURBO) ? "TURBO" : "turbo");
DPRINTF("pstate req = 0x%llx)\n", (val & 0xfffF));

View File

@ -1,4 +1,4 @@
/* $OpenBSD: intr.c,v 1.21 2022/07/27 20:26:17 kettenis Exp $ */
/* $OpenBSD: intr.c,v 1.22 2024/06/26 01:40:49 jsg Exp $ */
/*
* Copyright (c) 2011 Dale Rahn <drahn@openbsd.org>
*
@ -72,16 +72,21 @@ arm_dflt_intr(void *frame)
}
void *arm_intr_establish(int irqno, int level, int (*func)(void *),
void *
arm_intr_establish(int irqno, int level, int (*func)(void *),
void *cookie, char *name)
{
return arm_intr_func.intr_establish(irqno, level, NULL, func, cookie, name);
}
void arm_intr_disestablish(void *cookie)
void
arm_intr_disestablish(void *cookie)
{
arm_intr_func.intr_disestablish(cookie);
}
const char *arm_intr_string(void *cookie)
const char *
arm_intr_string(void *cookie)
{
return arm_intr_func.intr_string(cookie);
}
@ -657,13 +662,15 @@ arm_dflt_setipl(int newcpl)
ci->ci_cpl = newcpl;
}
void *arm_dflt_intr_establish(int irqno, int level, struct cpu_info *ci,
void *
arm_dflt_intr_establish(int irqno, int level, struct cpu_info *ci,
int (*func)(void *), void *cookie, char *name)
{
panic("arm_dflt_intr_establish called");
}
void arm_dflt_intr_disestablish(void *cookie)
void
arm_dflt_intr_disestablish(void *cookie)
{
panic("arm_dflt_intr_disestablish called");
}
@ -721,7 +728,8 @@ arm_do_pending_intr(int pcpl)
restore_interrupts(oldirqstate);
}
void arm_set_intr_handler(int (*raise)(int), int (*lower)(int),
void
arm_set_intr_handler(int (*raise)(int), int (*lower)(int),
void (*x)(int), void (*setipl)(int),
void *(*intr_establish)(int irqno, int level, struct cpu_info *ci,
int (*func)(void *), void *cookie, char *name),

View File

@ -1,4 +1,4 @@
/* $OpenBSD: intc.c,v 1.14 2024/04/29 12:42:06 jsg Exp $ */
/* $OpenBSD: intc.c,v 1.15 2024/06/26 01:40:49 jsg Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
*
@ -418,7 +418,8 @@ intc_tst(void *a)
}
void intc_test(void);
void intc_test(void)
void
intc_test(void)
{
void * ih;
printf("about to register handler\n");

View File

@ -1,4 +1,4 @@
/* $OpenBSD: omusbtll.c,v 1.5 2021/10/24 17:52:28 mpi Exp $ */
/* $OpenBSD: omusbtll.c,v 1.6 2024/06/26 01:40:49 jsg Exp $ */
/*
* Copyright (c) 2010 Dale Rahn <drahn@openbsd.org>
*
@ -132,8 +132,8 @@ omusbtll_attach(struct device *parent, struct device *self, void *args)
omusbtll_init(0x3);
}
void omusbtll_init(uint32_t channel_mask)
void
omusbtll_init(uint32_t channel_mask)
{
int i;
uint32_t val;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: machdep.c,v 1.40 2022/07/07 00:56:47 daniel Exp $ */
/* $OpenBSD: machdep.c,v 1.41 2024/06/26 01:40:49 jsg Exp $ */
/*
* Copyright (c) 2004 Tom Cosgrove
@ -112,7 +112,8 @@ machdep(void)
}
}
int check_skip_conf(void)
int
check_skip_conf(void)
{
/* Return non-zero (skip boot.conf) if Control "shift" key down */
#ifndef EFIBOOT

View File

@ -1,4 +1,4 @@
/* $OpenBSD: acpi.c,v 1.431 2024/06/11 17:35:26 kettenis Exp $ */
/* $OpenBSD: acpi.c,v 1.432 2024/06/25 11:57:10 kettenis Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@ -2115,6 +2115,11 @@ acpi_interrupt(void *arg)
if (!(en & sts & (1L << jdx)))
continue;
if (cpu_suspended) {
cpu_suspended = 0;
sc->sc_wakegpe = idx + jdx;
}
/* Signal this GPE */
gpe = idx + jdx;
sc->gpe_table[gpe].active = 1;
@ -2149,8 +2154,10 @@ acpi_interrupt(void *arg)
ACPI_PM1_PWRBTN_STS);
sts &= ~ACPI_PM1_PWRBTN_STS;
if (cpu_suspended)
if (cpu_suspended) {
cpu_suspended = 0;
sc->sc_wakegpe = -1;
}
acpi_addtask(sc, acpi_pbtn_task, sc, 0);
}
@ -2162,6 +2169,11 @@ acpi_interrupt(void *arg)
ACPI_PM1_SLPBTN_STS);
sts &= ~ACPI_PM1_SLPBTN_STS;
if (cpu_suspended) {
cpu_suspended = 0;
sc->sc_wakegpe = -2;
}
acpi_addtask(sc, acpi_sbtn_task, sc, 0);
}
if (sts) {

View File

@ -1,4 +1,4 @@
/* $OpenBSD: acpi_x86.c,v 1.21 2024/05/29 12:21:33 kettenis Exp $ */
/* $OpenBSD: acpi_x86.c,v 1.22 2024/06/25 11:57:10 kettenis Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@ -147,6 +147,19 @@ suspend_finish(void *v)
{
struct acpi_softc *sc = v;
printf("wakeup event: ");
switch (sc->sc_wakegpe) {
case -1:
printf("PWRBTN\n");
break;
case -2:
printf("SLPTN\n");
break;
default:
printf("GPE 0x%x\n", sc->sc_wakegpe);
break;
}
acpi_record_event(sc, APM_NORMAL_RESUME);
acpi_indicator(sc, ACPI_SST_WORKING);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: acpidebug.c,v 1.34 2024/05/13 01:15:50 jsg Exp $ */
/* $OpenBSD: acpidebug.c,v 1.35 2024/06/26 01:40:49 jsg Exp $ */
/*
* Copyright (c) 2006 Marco Peereboom <marco@openbsd.org>
*
@ -289,7 +289,8 @@ db_acpi_showval(db_expr_t addr, int haddr, db_expr_t count, char *modif)
db_printf("Not a valid value\n");
}
void db_disprint(void *arg, const char *fmt, ...)
void
db_disprint(void *arg, const char *fmt, ...)
{
va_list ap;

View File

@ -223,12 +223,14 @@ struct iommu_softc {
paddr_t evt_tblp;
};
static inline int iommu_bad(struct iommu_softc *sc)
static inline int
iommu_bad(struct iommu_softc *sc)
{
return (sc->flags & IOMMU_FLAGS_BAD);
}
static inline int iommu_enabled(struct iommu_softc *sc)
static inline int
iommu_enabled(struct iommu_softc *sc)
{
if (sc->dte) {
return 1;

View File

@ -230,12 +230,15 @@
#define IQA_QS_32K 7 /* 32768 */
/* Read-Modify-Write helpers */
static inline void iommu_rmw32(void *ov, uint32_t mask, uint32_t shift, uint32_t nv)
static inline void
iommu_rmw32(void *ov, uint32_t mask, uint32_t shift, uint32_t nv)
{
*(uint32_t *)ov &= ~(mask << shift);
*(uint32_t *)ov |= (nv & mask) << shift;
}
static inline void iommu_rmw64(void *ov, uint32_t mask, uint32_t shift, uint64_t nv)
static inline void
iommu_rmw64(void *ov, uint32_t mask, uint32_t shift, uint64_t nv)
{
*(uint64_t *)ov &= ~(mask << shift);
*(uint64_t *)ov |= (nv & mask) << shift;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: acpiec.c,v 1.65 2022/08/10 16:58:16 patrick Exp $ */
/* $OpenBSD: acpiec.c,v 1.66 2024/06/25 11:57:10 kettenis Exp $ */
/*
* Copyright (c) 2006 Can Erkin Acar <canacar@openbsd.org>
*
@ -274,6 +274,9 @@ acpiec_attach(struct device *parent, struct device *self, void *aux)
{
struct acpiec_softc *sc = (struct acpiec_softc *)self;
struct acpi_attach_args *aa = aux;
#ifndef SMALL_KERNEL
struct acpi_wakeq *wq;
#endif
struct aml_value res;
int64_t st;
@ -318,6 +321,17 @@ acpiec_attach(struct device *parent, struct device *self, void *aux)
#ifndef SMALL_KERNEL
acpi_set_gpehandler(sc->sc_acpi, sc->sc_gpe, acpiec_gpehandler,
sc, GPE_EDGE);
/*
* On many machines the EC is not listed as a wakeup device
* but is necessary to wake up from S0i.
*/
wq = malloc(sizeof(struct acpi_wakeq), M_DEVBUF, M_WAITOK | M_ZERO);
wq->q_node = sc->sc_devnode;
wq->q_gpe = sc->sc_gpe;
wq->q_state = ACPI_STATE_S0;
wq->q_enabled = 1;
SIMPLEQ_INSERT_TAIL(&sc->sc_acpi->sc_wakedevs, wq, q_next);
#endif
if (aml_evalname(sc->sc_acpi, sc->sc_devnode, "_GLK", 0, NULL, &res))

View File

@ -1,4 +1,4 @@
/* $OpenBSD: acpivar.h,v 1.127 2024/05/13 19:56:37 kettenis Exp $ */
/* $OpenBSD: acpivar.h,v 1.128 2024/06/25 11:57:10 kettenis Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@ -253,6 +253,7 @@ struct acpi_softc {
int slp_typb;
} sc_sleeptype[6];
int sc_lastgpe;
int sc_wakegpe;
struct gpe_block *gpe_table;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: dsdt.c,v 1.268 2024/05/14 08:26:13 jsg Exp $ */
/* $OpenBSD: dsdt.c,v 1.269 2024/06/26 01:40:49 jsg Exp $ */
/*
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
*
@ -251,7 +251,8 @@ struct aml_opcode aml_table[] = {
{ AMLOP_COPYOBJECT, "CopyObject", "tS", },
};
int aml_pc(uint8_t *src)
int
aml_pc(uint8_t *src)
{
return src - aml_root.start;
}
@ -1668,7 +1669,8 @@ aml_foreachpkg(struct aml_value *pkg, int start,
*/
int aml_fixup_node(struct aml_node *, void *);
int aml_fixup_node(struct aml_node *node, void *arg)
int
aml_fixup_node(struct aml_node *node, void *arg)
{
struct aml_value *val = arg;
int i;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: aic7xxx_openbsd.h,v 1.32 2024/05/29 00:48:15 jsg Exp $ */
/* $OpenBSD: aic7xxx_openbsd.h,v 1.33 2024/06/26 01:40:49 jsg Exp $ */
/* $NetBSD: aic7xxx_osm.h,v 1.7 2003/11/02 11:07:44 wiz Exp $ */
/*
@ -209,20 +209,20 @@ static __inline uint32_t ahc_get_sense_bufsize(struct ahc_softc *,
struct scb *);
static __inline void ahc_freeze_scb(struct scb *);
static __inline
void ahc_set_transaction_status(struct scb *scb, uint32_t status)
static __inline void
ahc_set_transaction_status(struct scb *scb, uint32_t status)
{
scb->xs->error = status;
}
static __inline
void ahc_set_scsi_status(struct scb *scb, uint32_t status)
static __inline void
ahc_set_scsi_status(struct scb *scb, uint32_t status)
{
scb->xs->status = status;
}
static __inline
uint32_t ahc_get_transaction_status(struct scb *scb)
static __inline uint32_t
ahc_get_transaction_status(struct scb *scb)
{
if (scb->xs->flags & ITSDONE)
return CAM_REQ_CMP;
@ -230,49 +230,49 @@ uint32_t ahc_get_transaction_status(struct scb *scb)
return scb->xs->error;
}
static __inline
uint32_t ahc_get_scsi_status(struct scb *scb)
static __inline uint32_t
ahc_get_scsi_status(struct scb *scb)
{
return (scb->xs->status);
}
static __inline
void ahc_set_transaction_tag(struct scb *scb, int enabled, u_int type)
static __inline void
ahc_set_transaction_tag(struct scb *scb, int enabled, u_int type)
{
}
static __inline
u_long ahc_get_transfer_length(struct scb *scb)
static __inline u_long
ahc_get_transfer_length(struct scb *scb)
{
return (scb->xs->datalen);
}
static __inline
int ahc_get_transfer_dir(struct scb *scb)
static __inline int
ahc_get_transfer_dir(struct scb *scb)
{
return (scb->xs->flags & (SCSI_DATA_IN | SCSI_DATA_OUT));
}
static __inline
void ahc_set_residual(struct scb *scb, u_long resid)
static __inline void
ahc_set_residual(struct scb *scb, u_long resid)
{
scb->xs->resid = resid;
}
static __inline
void ahc_set_sense_residual(struct scb *scb, u_long resid)
static __inline void
ahc_set_sense_residual(struct scb *scb, u_long resid)
{
scb->xs->resid = resid;
}
static __inline
u_long ahc_get_residual(struct scb *scb)
static __inline u_long
ahc_get_residual(struct scb *scb)
{
return (scb->xs->resid);
}
static __inline
int ahc_perform_autosense(struct scb *scb)
static __inline int
ahc_perform_autosense(struct scb *scb)
{
/* Return true for OpenBSD */
return (1);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ami.c,v 1.262 2022/04/16 19:19:58 naddy Exp $ */
/* $OpenBSD: ami.c,v 1.263 2024/06/26 01:40:49 jsg Exp $ */
/*
* Copyright (c) 2001 Michael Shalayeff
@ -2277,7 +2277,8 @@ bail:
return (error);
}
int ami_ioctl_alarm(struct ami_softc *sc, struct bioc_alarm *ba)
int
ami_ioctl_alarm(struct ami_softc *sc, struct bioc_alarm *ba)
{
int error = 0;
u_int8_t func, ret;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: bt463.c,v 1.13 2014/07/08 17:19:25 deraadt Exp $ */
/* $OpenBSD: bt463.c,v 1.14 2024/06/26 01:40:49 jsg Exp $ */
/* $NetBSD: bt463.c,v 1.2 2000/06/13 17:21:06 nathanw Exp $ */
/*-
@ -492,7 +492,8 @@ bt463_get_curcmap(rc, cursorp)
*/
#ifdef BT463_DEBUG
int bt463_store(void *v)
int
bt463_store(void *v)
{
struct bt463data *data = (struct bt463data *)v;
@ -504,7 +505,8 @@ int bt463_store(void *v)
}
int bt463_readback(void *v)
int
bt463_readback(void *v)
{
struct bt463data *data = (struct bt463data *)v;
@ -623,7 +625,8 @@ bt463_update(p)
data->changed = 0;
}
int bt463_set_cursor (rc, cur)
int
bt463_set_cursor (rc, cur)
struct ramdac_cookie *rc;
struct wsdisplay_cursor *cur;
{
@ -631,7 +634,8 @@ int bt463_set_cursor (rc, cur)
return tga_builtin_set_cursor(data->cookie, cur);
}
int bt463_get_cursor (rc, cur)
int
bt463_get_cursor (rc, cur)
struct ramdac_cookie *rc;
struct wsdisplay_cursor *cur;
{
@ -639,7 +643,8 @@ int bt463_get_cursor (rc, cur)
return tga_builtin_get_cursor(data->cookie, cur);
}
int bt463_set_curpos (rc, cur)
int
bt463_set_curpos (rc, cur)
struct ramdac_cookie *rc;
struct wsdisplay_curpos *cur;
{
@ -647,7 +652,8 @@ int bt463_set_curpos (rc, cur)
return tga_builtin_set_curpos(data->cookie, cur);
}
int bt463_get_curpos (rc, cur)
int
bt463_get_curpos (rc, cur)
struct ramdac_cookie *rc;
struct wsdisplay_curpos *cur;
{
@ -655,7 +661,8 @@ int bt463_get_curpos (rc, cur)
return tga_builtin_get_curpos(data->cookie, cur);
}
int bt463_get_curmax (rc, cur)
int
bt463_get_curmax (rc, cur)
struct ramdac_cookie *rc;
struct wsdisplay_curpos *cur;
{

View File

@ -1,4 +1,4 @@
/* $OpenBSD: iosf.c,v 1.1 2023/04/23 00:20:26 dlg Exp $ */
/* $OpenBSD: iosf.c,v 1.2 2024/06/26 01:40:49 jsg Exp $ */
/*
* Copyright (c) 2023 David Gwynne <dlg@openbsd.org>
@ -253,7 +253,8 @@ iosf_mbi_punit_release(void)
rw_exit_write(&iosf_lock);
}
void iosf_mbi_assert_punit_acquired(void)
void
iosf_mbi_assert_punit_acquired(void)
{
int s;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: rtwn.c,v 1.57 2023/04/28 01:24:14 kevlo Exp $ */
/* $OpenBSD: rtwn.c,v 1.58 2024/06/26 01:40:49 jsg Exp $ */
/*-
* Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr>
@ -857,7 +857,8 @@ rtwn_ra_init(struct rtwn_softc *sc)
/*
* Initialize rate adaptation in firmware.
*/
int rtwn_r92c_ra_init(struct rtwn_softc *sc, u_int8_t mode, u_int32_t rates,
int
rtwn_r92c_ra_init(struct rtwn_softc *sc, u_int8_t mode, u_int32_t rates,
int maxrate, uint32_t basicrates, int maxbasicrate)
{
struct r92c_fw_cmd_macid_cfg cmd;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ess_isapnp.c,v 1.8 2022/04/06 18:59:28 naddy Exp $ */
/* $OpenBSD: ess_isapnp.c,v 1.9 2024/06/26 01:40:49 jsg Exp $ */
/* $NetBSD: ess_isa.c,v 1.4 1999/03/18 20:57:11 mycroft Exp $ */
/*-
@ -63,7 +63,8 @@ ess_isapnp_probe(struct device *parent, void *match, void *aux)
return 1;
}
void ess_isapnp_attach(struct device *parent, struct device *self, void *aux)
void
ess_isapnp_attach(struct device *parent, struct device *self, void *aux)
{
struct ess_softc *sc = (void *)self;
struct isa_attach_args *ia = aux;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: eephy.c,v 1.65 2024/03/17 00:06:43 patrick Exp $ */
/* $OpenBSD: eephy.c,v 1.66 2024/06/26 01:40:49 jsg Exp $ */
/*
* Principal Author: Parag Patel
* Copyright (c) 2001
@ -443,7 +443,8 @@ eephy_status(struct mii_softc *sc)
}
#ifdef __HAVE_FDT
void eephy_fdt_reg_init(struct mii_softc *sc)
void
eephy_fdt_reg_init(struct mii_softc *sc)
{
uint32_t *prop, opage;
int i, len;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: xmphy.c,v 1.25 2024/05/27 04:58:43 jsg Exp $ */
/* $OpenBSD: xmphy.c,v 1.26 2024/06/26 01:40:49 jsg Exp $ */
/*
* Copyright (c) 2000
@ -85,7 +85,8 @@ static const struct mii_phydesc xmphys[] = {
NULL },
};
int xmphy_probe(struct device *parent, void *match, void *aux)
int
xmphy_probe(struct device *parent, void *match, void *aux)
{
struct mii_attach_args *ma = aux;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: bktr_core.c,v 1.44 2024/06/22 10:22:29 jsg Exp $ */
/* $OpenBSD: bktr_core.c,v 1.45 2024/06/26 01:40:49 jsg Exp $ */
/* $FreeBSD: src/sys/dev/bktr/bktr_core.c,v 1.114 2000/10/31 13:09:56 roger Exp $ */
/*
@ -3504,7 +3504,8 @@ set_fps( bktr_ptr_t bktr, u_short fps )
* as one would expect.
*/
static u_int pixfmt_swap_flags( int pixfmt )
static u_int
pixfmt_swap_flags( int pixfmt )
{
const struct meteor_pixfmt *pf = &pixfmt_table[ pixfmt ].public;
u_int swapf = 0;
@ -3541,7 +3542,8 @@ static u_int pixfmt_swap_flags( int pixfmt )
* our pixfmt_table indices.
*/
static int oformat_meteor_to_bt( u_int format )
static int
oformat_meteor_to_bt( u_int format )
{
int i;
const struct meteor_pixfmt *pf1, *pf2;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: if_bnxt.c,v 1.50 2024/05/24 06:02:53 jsg Exp $ */
/* $OpenBSD: if_bnxt.c,v 1.51 2024/06/26 01:40:49 jsg Exp $ */
/*-
* Broadcom NetXtreme-C/E network driver.
*
@ -3502,7 +3502,8 @@ _bnxt_hwrm_set_async_event_bit(struct hwrm_func_drv_rgtr_input *req, int bit)
req->async_event_fwd[bit/32] |= (1 << (bit % 32));
}
int bnxt_hwrm_func_rgtr_async_events(struct bnxt_softc *softc)
int
bnxt_hwrm_func_rgtr_async_events(struct bnxt_softc *softc)
{
struct hwrm_func_drv_rgtr_input req = {0};
int events[] = {

View File

@ -31,7 +31,7 @@
*******************************************************************************/
/* $OpenBSD: if_em_hw.c,v 1.121 2024/05/24 06:02:53 jsg Exp $ */
/* $OpenBSD: if_em_hw.c,v 1.122 2024/06/26 01:40:49 jsg Exp $ */
/*
* if_em_hw.c Shared functions for accessing and configuring the MAC
*/
@ -5515,7 +5515,8 @@ em_write_kmrn_reg(struct em_hw *hw, uint32_t reg_addr, uint16_t data)
* Called to determine if the I2C pins are being used for I2C or as an
* external MDIO interface since the two options are mutually exclusive.
**/
int em_sgmii_uses_mdio_82575(struct em_hw *hw)
int
em_sgmii_uses_mdio_82575(struct em_hw *hw)
{
uint32_t reg = 0;
int ext_mdio = 0;
@ -5549,7 +5550,8 @@ int em_sgmii_uses_mdio_82575(struct em_hw *hw)
* Reads the PHY register at offset using the i2c interface and stores the
* retrieved information in data.
**/
int32_t em_read_phy_reg_i2c(struct em_hw *hw, uint32_t offset, uint16_t *data)
int32_t
em_read_phy_reg_i2c(struct em_hw *hw, uint32_t offset, uint16_t *data)
{
uint32_t i, i2ccmd = 0;
@ -5595,7 +5597,8 @@ int32_t em_read_phy_reg_i2c(struct em_hw *hw, uint32_t offset, uint16_t *data)
*
* Writes the data to PHY register at the offset using the i2c interface.
**/
int32_t em_write_phy_reg_i2c(struct em_hw *hw, uint32_t offset, uint16_t data)
int32_t
em_write_phy_reg_i2c(struct em_hw *hw, uint32_t offset, uint16_t data)
{
uint32_t i, i2ccmd = 0;
uint16_t phy_data_swapped;
@ -5655,7 +5658,8 @@ int32_t em_write_phy_reg_i2c(struct em_hw *hw, uint32_t offset, uint16_t data)
* E1000_I2CCMD_SFP_DIAG_ADDR(<byte offset>) for SFP diagnostics parameters
* access
**/
int32_t em_read_sfp_data_byte(struct em_hw *hw, uint16_t offset, uint8_t *data)
int32_t
em_read_sfp_data_byte(struct em_hw *hw, uint16_t offset, uint8_t *data)
{
uint32_t i = 0;
uint32_t i2ccmd = 0;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: if_iwx.c,v 1.186 2024/05/24 06:02:53 jsg Exp $ */
/* $OpenBSD: if_iwx.c,v 1.187 2024/06/26 01:40:49 jsg Exp $ */
/*
* Copyright (c) 2014, 2016 genua gmbh <info@genua.de>
@ -597,7 +597,8 @@ iwx_ctxt_info_alloc_dma(struct iwx_softc *sc,
return 0;
}
void iwx_ctxt_info_free_paging(struct iwx_softc *sc)
void
iwx_ctxt_info_free_paging(struct iwx_softc *sc)
{
struct iwx_self_init_dram *dram = &sc->init_dram;
int i;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: if_sk.c,v 1.196 2024/05/24 06:02:57 jsg Exp $ */
/* $OpenBSD: if_sk.c,v 1.197 2024/06/26 01:40:49 jsg Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
@ -2083,7 +2083,8 @@ sk_init_xmac(struct sk_if_softc *sc_if)
sc_if->sk_link = 1;
}
void sk_init_yukon(struct sk_if_softc *sc_if)
void
sk_init_yukon(struct sk_if_softc *sc_if)
{
u_int32_t phy, v;
u_int16_t reg;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: virtio_pci.c,v 1.37 2024/05/17 16:37:10 sf Exp $ */
/* $OpenBSD: virtio_pci.c,v 1.38 2024/06/26 01:40:49 jsg Exp $ */
/* $NetBSD: virtio.c,v 1.3 2011/11/02 23:05:52 njoly Exp $ */
/*
@ -162,8 +162,8 @@ struct virtio_ops virtio_pci_ops = {
virtio_pci_poll_intr,
};
static inline
uint64_t _cread(struct virtio_pci_softc *sc, unsigned off, unsigned size)
static inline uint64_t
_cread(struct virtio_pci_softc *sc, unsigned off, unsigned size)
{
uint64_t val;
switch (size) {

View File

@ -1,4 +1,4 @@
/* $OpenBSD: yds.c,v 1.64 2024/05/24 06:02:58 jsg Exp $ */
/* $OpenBSD: yds.c,v 1.65 2024/06/26 01:40:49 jsg Exp $ */
/* $NetBSD: yds.c,v 1.5 2001/05/21 23:55:04 minoura Exp $ */
/*
@ -107,27 +107,36 @@ void YWRITE1(struct yds_softc *sc,bus_size_t r,u_int8_t x);
void YWRITE2(struct yds_softc *sc,bus_size_t r,u_int16_t x);
void YWRITE4(struct yds_softc *sc,bus_size_t r,u_int32_t x);
u_int16_t YREAD2(struct yds_softc *sc,bus_size_t r)
u_int16_t
YREAD2(struct yds_softc *sc,bus_size_t r)
{
DPRINTFN(5, (" YREAD2(0x%lX)\n",(unsigned long)r));
return bus_space_read_2(sc->memt,sc->memh,r);
}
u_int32_t YREAD4(struct yds_softc *sc,bus_size_t r)
u_int32_t
YREAD4(struct yds_softc *sc,bus_size_t r)
{
DPRINTFN(5, (" YREAD4(0x%lX)\n",(unsigned long)r));
return bus_space_read_4(sc->memt,sc->memh,r);
}
void YWRITE1(struct yds_softc *sc,bus_size_t r,u_int8_t x)
void
YWRITE1(struct yds_softc *sc,bus_size_t r,u_int8_t x)
{
DPRINTFN(5, (" YWRITE1(0x%lX,0x%lX)\n",(unsigned long)r,(unsigned long)x));
bus_space_write_1(sc->memt,sc->memh,r,x);
}
void YWRITE2(struct yds_softc *sc,bus_size_t r,u_int16_t x)
void
YWRITE2(struct yds_softc *sc,bus_size_t r,u_int16_t x)
{
DPRINTFN(5, (" YWRITE2(0x%lX,0x%lX)\n",(unsigned long)r,(unsigned long)x));
bus_space_write_2(sc->memt,sc->memh,r,x);
}
void YWRITE4(struct yds_softc *sc,bus_size_t r,u_int32_t x)
void
YWRITE4(struct yds_softc *sc,bus_size_t r,u_int32_t x)
{
DPRINTFN(5, (" YWRITE4(0x%lX,0x%lX)\n",(unsigned long)r,(unsigned long)x));
bus_space_write_4(sc->memt,sc->memh,r,x);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: if_vio.c,v 1.40 2024/06/10 19:26:17 jan Exp $ */
/* $OpenBSD: if_vio.c,v 1.41 2024/06/26 01:40:49 jsg Exp $ */
/*
* Copyright (c) 2012 Stefan Fritsch, Alexander Fiveg.
@ -524,7 +524,8 @@ vio_put_lladdr(struct arpcom *ac, struct virtio_softc *vsc)
}
}
static int vio_needs_reset(struct vio_softc *sc)
static int
vio_needs_reset(struct vio_softc *sc)
{
if (virtio_get_status(sc->sc_virtio) &
VIRTIO_CONFIG_DEVICE_STATUS_DEVICE_NEEDS_RESET) {

View File

@ -1,4 +1,4 @@
/* $OpenBSD: vioblk.c,v 1.38 2024/05/24 10:05:55 jsg Exp $ */
/* $OpenBSD: vioblk.c,v 1.39 2024/06/26 01:40:49 jsg Exp $ */
/*
* Copyright (c) 2012 Stefan Fritsch.
@ -150,7 +150,8 @@ const struct scsi_adapter vioblk_switch = {
vioblk_scsi_cmd, NULL, NULL, NULL, NULL
};
int vioblk_match(struct device *parent, void *match, void *aux)
int
vioblk_match(struct device *parent, void *match, void *aux)
{
struct virtio_softc *va = aux;
if (va->sc_childdevid == PCI_PRODUCT_VIRTIO_BLOCK)

View File

@ -1,4 +1,4 @@
/* $OpenBSD: viocon.c,v 1.11 2024/05/24 10:05:55 jsg Exp $ */
/* $OpenBSD: viocon.c,v 1.12 2024/06/26 01:40:49 jsg Exp $ */
/*
* Copyright (c) 2013-2015 Stefan Fritsch <sf@sfritsch.de>
@ -159,7 +159,8 @@ dev2port(dev_t dev)
return dev2sc(dev)->sc_ports[VIOCONPORT(dev)];
}
int viocon_match(struct device *parent, void *match, void *aux)
int
viocon_match(struct device *parent, void *match, void *aux)
{
struct virtio_softc *va = aux;
if (va->sc_childdevid == PCI_PRODUCT_VIRTIO_CONSOLE)

View File

@ -1,4 +1,4 @@
/* $OpenBSD: viornd.c,v 1.8 2024/05/24 10:05:55 jsg Exp $ */
/* $OpenBSD: viornd.c,v 1.9 2024/06/26 01:40:49 jsg Exp $ */
/*
* Copyright (c) 2014 Stefan Fritsch <sf@sfritsch.de>
@ -69,8 +69,8 @@ struct cfdriver viornd_cd = {
NULL, "viornd", DV_DULL
};
int viornd_match(struct device *parent, void *match, void *aux)
int
viornd_match(struct device *parent, void *match, void *aux)
{
struct virtio_softc *va = aux;
if (va->sc_childdevid == PCI_PRODUCT_VIRTIO_ENTROPY)

View File

@ -1,4 +1,4 @@
/* $OpenBSD: wsmouse.c,v 1.72 2024/05/17 20:11:58 miod Exp $ */
/* $OpenBSD: wsmouse.c,v 1.73 2024/06/26 01:40:49 jsg Exp $ */
/* $NetBSD: wsmouse.c,v 1.35 2005/02/27 00:27:52 perry Exp $ */
/*
@ -1622,7 +1622,8 @@ wsmouse_set_mode(struct device *sc, int mode)
return (-1);
}
struct wsmousehw *wsmouse_get_hw(struct device *sc)
struct wsmousehw *
wsmouse_get_hw(struct device *sc)
{
return &((struct wsmouse_softc *) sc)->sc_input.hw;
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: kern_malloc.c,v 1.151 2023/12/14 14:04:57 claudio Exp $ */
/* $OpenBSD: kern_malloc.c,v 1.152 2024/06/26 01:40:49 jsg Exp $ */
/* $NetBSD: kern_malloc.c,v 1.15.4.2 1996/06/13 17:10:56 cgd Exp $ */
/*
@ -54,7 +54,8 @@ static
#ifndef SMALL_KERNEL
__inline__
#endif
long BUCKETINDX(size_t sz)
long
BUCKETINDX(size_t sz)
{
long b, d;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: if_pppoe.c,v 1.83 2022/07/14 11:03:15 mvs Exp $ */
/* $OpenBSD: if_pppoe.c,v 1.84 2024/06/26 01:40:49 jsg Exp $ */
/* $NetBSD: if_pppoe.c,v 1.51 2003/11/28 08:56:48 keihan Exp $ */
/*
@ -188,7 +188,8 @@ struct mbuf_queue pppoediscinq = MBUF_QUEUE_INITIALIZER(
struct mbuf_queue pppoeinq = MBUF_QUEUE_INITIALIZER(
IFQ_MAXLEN, IPL_SOFTNET);
void pppoeintr(void)
void
pppoeintr(void)
{
struct mbuf_list ml;
struct mbuf *m;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: nfs_syscalls.c,v 1.126 2024/05/01 13:15:59 jsg Exp $ */
/* $OpenBSD: nfs_syscalls.c,v 1.127 2024/06/26 01:40:49 jsg Exp $ */
/* $NetBSD: nfs_syscalls.c,v 1.19 1996/02/18 11:53:52 fvdl Exp $ */
/*
@ -302,7 +302,8 @@ nfssvc_addsock(struct file *fp, struct mbuf *mynam)
return (0);
}
static inline int nfssvc_checknam(struct mbuf *nam)
static inline int
nfssvc_checknam(struct mbuf *nam)
{
struct sockaddr_in *sin;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: rde_prefix.c,v 1.50 2023/07/12 14:45:43 claudio Exp $ */
/* $OpenBSD: rde_prefix.c,v 1.51 2024/06/25 13:21:18 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org>
@ -567,6 +567,9 @@ pt_writebuf(struct ibuf *buf, struct pt_entry *pte, int withdraw,
goto fail;
}
/* keep 2 bytes reserved in the withdraw case for IPv4 encoding */
if (withdraw && ibuf_left(buf) < ibuf_size(tmp) + 2)
goto fail;
if (ibuf_add_buf(buf, tmp) == -1)
goto fail;
ibuf_free(tmp);