Merge 5.15.92 into android14-5.15

Changes in 5.15.92
	ARM: dts: imx: Fix pca9547 i2c-mux node name
	ARM: dts: vf610: Fix pca9548 i2c-mux node names
	arm64: dts: freescale: Fix pca954x i2c-mux node names
	arm64: dts: imx8mq-thor96: fix no-mmc property for SDHCI
	firmware: arm_scmi: Clear stale xfer->hdr.status
	bpf: Skip task with pid=1 in send_signal_common()
	erofs/zmap.c: Fix incorrect offset calculation
	blk-cgroup: fix missing pd_online_fn() while activating policy
	HID: playstation: sanity check DualSense calibration data.
	dmaengine: imx-sdma: Fix a possible memory leak in sdma_transfer_init
	cifs: fix return of uninitialized rc in dfs_cache_update_tgthint()
	ext4: fix bad checksum after online resize
	extcon: usbc-tusb320: fix kernel-doc warning
	ACPI: processor idle: Practically limit "Dummy wait" workaround to old Intel systems
	Bluetooth: fix null ptr deref on hci_sync_conn_complete_evt
	tools: fix ARRAY_SIZE defines in tools and selftests hdrs
	selftests/vm: remove ARRAY_SIZE define from individual tests
	selftests: Provide local define of __cpuid_count()
	net: fix NULL pointer in skb_segment_list
	net: mctp: purge receive queues on sk destruction
	Linux 5.15.92

Change-Id: Ia09e2a458fdd8f6f527e5d2ecff18cbb40c6ef10
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Greg Kroah-Hartman
2023-02-06 10:45:01 +00:00
36 changed files with 143 additions and 38 deletions

View File

@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
VERSION = 5 VERSION = 5
PATCHLEVEL = 15 PATCHLEVEL = 15
SUBLEVEL = 91 SUBLEVEL = 92
EXTRAVERSION = EXTRAVERSION =
NAME = Trick or Treat NAME = Trick or Treat

View File

@@ -488,7 +488,7 @@
scl-gpios = <&gpio3 21 GPIO_ACTIVE_HIGH>; scl-gpios = <&gpio3 21 GPIO_ACTIVE_HIGH>;
status = "okay"; status = "okay";
i2c-switch@70 { i2c-mux@70 {
compatible = "nxp,pca9547"; compatible = "nxp,pca9547";
#address-cells = <1>; #address-cells = <1>;
#size-cells = <0>; #size-cells = <0>;

View File

@@ -343,7 +343,7 @@
}; };
&i2c2 { &i2c2 {
tca9548@70 { i2c-mux@70 {
compatible = "nxp,pca9548"; compatible = "nxp,pca9548";
pinctrl-0 = <&pinctrl_i2c_mux_reset>; pinctrl-0 = <&pinctrl_i2c_mux_reset>;
pinctrl-names = "default"; pinctrl-names = "default";

View File

@@ -340,7 +340,7 @@
}; };
&i2c2 { &i2c2 {
tca9548@70 { i2c-mux@70 {
compatible = "nxp,pca9548"; compatible = "nxp,pca9548";
pinctrl-0 = <&pinctrl_i2c_mux_reset>; pinctrl-0 = <&pinctrl_i2c_mux_reset>;
pinctrl-names = "default"; pinctrl-names = "default";

View File

@@ -110,7 +110,7 @@
&i2c0 { &i2c0 {
status = "okay"; status = "okay";
pca9547@77 { i2c-mux@77 {
compatible = "nxp,pca9547"; compatible = "nxp,pca9547";
reg = <0x77>; reg = <0x77>;
#address-cells = <1>; #address-cells = <1>;

View File

@@ -70,7 +70,7 @@
&i2c0 { &i2c0 {
status = "okay"; status = "okay";
pca9547@77 { i2c-mux@77 {
compatible = "nxp,pca9547"; compatible = "nxp,pca9547";
reg = <0x77>; reg = <0x77>;
#address-cells = <1>; #address-cells = <1>;

View File

@@ -76,7 +76,7 @@
&i2c0 { &i2c0 {
status = "okay"; status = "okay";
pca9547@77 { i2c-mux@77 {
compatible = "nxp,pca9547"; compatible = "nxp,pca9547";
reg = <0x77>; reg = <0x77>;
#address-cells = <1>; #address-cells = <1>;

View File

@@ -53,7 +53,7 @@
&i2c0 { &i2c0 {
status = "okay"; status = "okay";
i2c-switch@77 { i2c-mux@77 {
compatible = "nxp,pca9547"; compatible = "nxp,pca9547";
reg = <0x77>; reg = <0x77>;
#address-cells = <1>; #address-cells = <1>;

View File

@@ -136,7 +136,7 @@
&i2c0 { &i2c0 {
status = "okay"; status = "okay";
i2c-switch@77 { i2c-mux@77 {
compatible = "nxp,pca9547"; compatible = "nxp,pca9547";
reg = <0x77>; reg = <0x77>;
#address-cells = <1>; #address-cells = <1>;

View File

@@ -245,7 +245,7 @@
&i2c3 { &i2c3 {
status = "okay"; status = "okay";
i2c-switch@70 { i2c-mux@70 {
compatible = "nxp,pca9540"; compatible = "nxp,pca9540";
#address-cells = <1>; #address-cells = <1>;
#size-cells = <0>; #size-cells = <0>;

View File

@@ -44,7 +44,7 @@
&i2c0 { &i2c0 {
status = "okay"; status = "okay";
pca9547@77 { i2c-mux@77 {
compatible = "nxp,pca9547"; compatible = "nxp,pca9547";
reg = <0x77>; reg = <0x77>;
#address-cells = <1>; #address-cells = <1>;

View File

@@ -44,7 +44,7 @@
&i2c0 { &i2c0 {
status = "okay"; status = "okay";
pca9547@75 { i2c-mux@75 {
compatible = "nxp,pca9547"; compatible = "nxp,pca9547";
reg = <0x75>; reg = <0x75>;
#address-cells = <1>; #address-cells = <1>;

View File

@@ -54,7 +54,7 @@
&i2c0 { &i2c0 {
status = "okay"; status = "okay";
i2c-switch@77 { i2c-mux@77 {
compatible = "nxp,pca9547"; compatible = "nxp,pca9547";
#address-cells = <1>; #address-cells = <1>;
#size-cells = <0>; #size-cells = <0>;

View File

@@ -214,7 +214,7 @@
pinctrl-0 = <&pinctrl_i2c3>; pinctrl-0 = <&pinctrl_i2c3>;
status = "okay"; status = "okay";
i2cmux@70 { i2c-mux@70 {
compatible = "nxp,pca9540"; compatible = "nxp,pca9540";
reg = <0x70>; reg = <0x70>;
#address-cells = <1>; #address-cells = <1>;

View File

@@ -133,7 +133,7 @@
pinctrl-0 = <&pinctrl_i2c1>; pinctrl-0 = <&pinctrl_i2c1>;
status = "okay"; status = "okay";
i2cmux@70 { i2c-mux@70 {
compatible = "nxp,pca9546"; compatible = "nxp,pca9546";
pinctrl-names = "default"; pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c1_pca9546>; pinctrl-0 = <&pinctrl_i2c1_pca9546>;
@@ -216,7 +216,7 @@
pinctrl-0 = <&pinctrl_i2c4>; pinctrl-0 = <&pinctrl_i2c4>;
status = "okay"; status = "okay";
pca9546: i2cmux@70 { pca9546: i2c-mux@70 {
compatible = "nxp,pca9546"; compatible = "nxp,pca9546";
reg = <0x70>; reg = <0x70>;
#address-cells = <1>; #address-cells = <1>;

View File

@@ -339,7 +339,7 @@
bus-width = <4>; bus-width = <4>;
non-removable; non-removable;
no-sd; no-sd;
no-emmc; no-mmc;
status = "okay"; status = "okay";
brcmf: wifi@1 { brcmf: wifi@1 {
@@ -359,7 +359,7 @@
cd-gpios = <&gpio2 12 GPIO_ACTIVE_LOW>; cd-gpios = <&gpio2 12 GPIO_ACTIVE_LOW>;
bus-width = <4>; bus-width = <4>;
no-sdio; no-sdio;
no-emmc; no-mmc;
disable-wp; disable-wp;
status = "okay"; status = "okay";
}; };

View File

@@ -61,7 +61,7 @@
pinctrl-0 = <&pinctrl_lpi2c1 &pinctrl_ioexp_rst>; pinctrl-0 = <&pinctrl_lpi2c1 &pinctrl_ioexp_rst>;
status = "okay"; status = "okay";
i2c-switch@71 { i2c-mux@71 {
compatible = "nxp,pca9646", "nxp,pca9546"; compatible = "nxp,pca9646", "nxp,pca9546";
#address-cells = <1>; #address-cells = <1>;
#size-cells = <0>; #size-cells = <0>;

View File

@@ -1360,6 +1360,10 @@ retry:
list_for_each_entry_reverse(blkg, &q->blkg_list, q_node) list_for_each_entry_reverse(blkg, &q->blkg_list, q_node)
pol->pd_init_fn(blkg->pd[pol->plid]); pol->pd_init_fn(blkg->pd[pol->plid]);
if (pol->pd_online_fn)
list_for_each_entry_reverse(blkg, &q->blkg_list, q_node)
pol->pd_online_fn(blkg->pd[pol->plid]);
__set_bit(pol->plid, q->blkcg_pols); __set_bit(pol->plid, q->blkcg_pols);
ret = 0; ret = 0;

View File

@@ -531,10 +531,27 @@ static void wait_for_freeze(void)
/* No delay is needed if we are in guest */ /* No delay is needed if we are in guest */
if (boot_cpu_has(X86_FEATURE_HYPERVISOR)) if (boot_cpu_has(X86_FEATURE_HYPERVISOR))
return; return;
/*
* Modern (>=Nehalem) Intel systems use ACPI via intel_idle,
* not this code. Assume that any Intel systems using this
* are ancient and may need the dummy wait. This also assumes
* that the motivating chipset issue was Intel-only.
*/
if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
return;
#endif #endif
/* Dummy wait op - must do something useless after P_LVL2 read /*
because chipsets cannot guarantee that STPCLK# signal * Dummy wait op - must do something useless after P_LVL2 read
gets asserted in time to freeze execution properly. */ * because chipsets cannot guarantee that STPCLK# signal gets
* asserted in time to freeze execution properly
*
* This workaround has been in place since the original ACPI
* implementation was merged, circa 2002.
*
* If a profile is pointing to this instruction, please first
* consider moving your system to a more modern idle
* mechanism.
*/
inl(acpi_gbl_FADT.xpm_timer_block.address); inl(acpi_gbl_FADT.xpm_timer_block.address);
} }

View File

@@ -1428,10 +1428,12 @@ static struct sdma_desc *sdma_transfer_init(struct sdma_channel *sdmac,
sdma_config_ownership(sdmac, false, true, false); sdma_config_ownership(sdmac, false, true, false);
if (sdma_load_context(sdmac)) if (sdma_load_context(sdmac))
goto err_desc_out; goto err_bd_out;
return desc; return desc;
err_bd_out:
sdma_free_bd(desc);
err_desc_out: err_desc_out:
kfree(desc); kfree(desc);
err_out: err_out:

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
/** /*
* drivers/extcon/extcon-tusb320.c - TUSB320 extcon driver * drivers/extcon/extcon-tusb320.c - TUSB320 extcon driver
* *
* Copyright (C) 2020 National Instruments Corporation * Copyright (C) 2020 National Instruments Corporation

View File

@@ -783,6 +783,8 @@ static int do_xfer(const struct scmi_protocol_handle *ph,
xfer->hdr.protocol_id, xfer->hdr.seq, xfer->hdr.protocol_id, xfer->hdr.seq,
xfer->hdr.poll_completion); xfer->hdr.poll_completion);
/* Clear any stale status */
xfer->hdr.status = SCMI_SUCCESS;
xfer->state = SCMI_XFER_SENT_OK; xfer->state = SCMI_XFER_SENT_OK;
/* /*
* Even though spinlocking is not needed here since no race is possible * Even though spinlocking is not needed here since no race is possible

View File

@@ -626,6 +626,7 @@ static const struct attribute_group ps_device_attribute_group = {
static int dualsense_get_calibration_data(struct dualsense *ds) static int dualsense_get_calibration_data(struct dualsense *ds)
{ {
struct hid_device *hdev = ds->base.hdev;
short gyro_pitch_bias, gyro_pitch_plus, gyro_pitch_minus; short gyro_pitch_bias, gyro_pitch_plus, gyro_pitch_minus;
short gyro_yaw_bias, gyro_yaw_plus, gyro_yaw_minus; short gyro_yaw_bias, gyro_yaw_plus, gyro_yaw_minus;
short gyro_roll_bias, gyro_roll_plus, gyro_roll_minus; short gyro_roll_bias, gyro_roll_plus, gyro_roll_minus;
@@ -636,6 +637,7 @@ static int dualsense_get_calibration_data(struct dualsense *ds)
int speed_2x; int speed_2x;
int range_2g; int range_2g;
int ret = 0; int ret = 0;
int i;
uint8_t *buf; uint8_t *buf;
buf = kzalloc(DS_FEATURE_REPORT_CALIBRATION_SIZE, GFP_KERNEL); buf = kzalloc(DS_FEATURE_REPORT_CALIBRATION_SIZE, GFP_KERNEL);
@@ -687,6 +689,21 @@ static int dualsense_get_calibration_data(struct dualsense *ds)
ds->gyro_calib_data[2].sens_numer = speed_2x*DS_GYRO_RES_PER_DEG_S; ds->gyro_calib_data[2].sens_numer = speed_2x*DS_GYRO_RES_PER_DEG_S;
ds->gyro_calib_data[2].sens_denom = gyro_roll_plus - gyro_roll_minus; ds->gyro_calib_data[2].sens_denom = gyro_roll_plus - gyro_roll_minus;
/*
* Sanity check gyro calibration data. This is needed to prevent crashes
* during report handling of virtual, clone or broken devices not implementing
* calibration data properly.
*/
for (i = 0; i < ARRAY_SIZE(ds->gyro_calib_data); i++) {
if (ds->gyro_calib_data[i].sens_denom == 0) {
hid_warn(hdev, "Invalid gyro calibration data for axis (%d), disabling calibration.",
ds->gyro_calib_data[i].abs_code);
ds->gyro_calib_data[i].bias = 0;
ds->gyro_calib_data[i].sens_numer = DS_GYRO_RANGE;
ds->gyro_calib_data[i].sens_denom = S16_MAX;
}
}
/* /*
* Set accelerometer calibration and normalization parameters. * Set accelerometer calibration and normalization parameters.
* Data values will be normalized to 1/DS_ACC_RES_PER_G g. * Data values will be normalized to 1/DS_ACC_RES_PER_G g.
@@ -709,6 +726,21 @@ static int dualsense_get_calibration_data(struct dualsense *ds)
ds->accel_calib_data[2].sens_numer = 2*DS_ACC_RES_PER_G; ds->accel_calib_data[2].sens_numer = 2*DS_ACC_RES_PER_G;
ds->accel_calib_data[2].sens_denom = range_2g; ds->accel_calib_data[2].sens_denom = range_2g;
/*
* Sanity check accelerometer calibration data. This is needed to prevent crashes
* during report handling of virtual, clone or broken devices not implementing calibration
* data properly.
*/
for (i = 0; i < ARRAY_SIZE(ds->accel_calib_data); i++) {
if (ds->accel_calib_data[i].sens_denom == 0) {
hid_warn(hdev, "Invalid accelerometer calibration data for axis (%d), disabling calibration.",
ds->accel_calib_data[i].abs_code);
ds->accel_calib_data[i].bias = 0;
ds->accel_calib_data[i].sens_numer = DS_ACC_RANGE;
ds->accel_calib_data[i].sens_denom = S16_MAX;
}
}
err_free: err_free:
kfree(buf); kfree(buf);
return ret; return ret;

View File

@@ -1050,10 +1050,10 @@ int dfs_cache_update_tgthint(const unsigned int xid, struct cifs_ses *ses,
const struct nls_table *cp, int remap, const char *path, const struct nls_table *cp, int remap, const char *path,
const struct dfs_cache_tgt_iterator *it) const struct dfs_cache_tgt_iterator *it)
{ {
int rc;
const char *npath;
struct cache_entry *ce;
struct cache_dfs_tgt *t; struct cache_dfs_tgt *t;
struct cache_entry *ce;
const char *npath;
int rc = 0;
npath = dfs_cache_canonical_path(path, cp, remap); npath = dfs_cache_canonical_path(path, cp, remap);
if (IS_ERR(npath)) if (IS_ERR(npath))

View File

@@ -719,12 +719,16 @@ static int z_erofs_iomap_begin_report(struct inode *inode, loff_t offset,
iomap->type = IOMAP_HOLE; iomap->type = IOMAP_HOLE;
iomap->addr = IOMAP_NULL_ADDR; iomap->addr = IOMAP_NULL_ADDR;
/* /*
* No strict rule how to describe extents for post EOF, yet * No strict rule on how to describe extents for post EOF, yet
* we need do like below. Otherwise, iomap itself will get * we need to do like below. Otherwise, iomap itself will get
* into an endless loop on post EOF. * into an endless loop on post EOF.
*
* Calculate the effective offset by subtracting extent start
* (map.m_la) from the requested offset, and add it to length.
* (NB: offset >= map.m_la always)
*/ */
if (iomap->offset >= inode->i_size) if (iomap->offset >= inode->i_size)
iomap->length = length + map.m_la - offset; iomap->length = length + offset - map.m_la;
} }
iomap->flags = 0; iomap->flags = 0;
return 0; return 0;

View File

@@ -1445,8 +1445,6 @@ static void ext4_update_super(struct super_block *sb,
* active. */ * active. */
ext4_r_blocks_count_set(es, ext4_r_blocks_count(es) + ext4_r_blocks_count_set(es, ext4_r_blocks_count(es) +
reserved_blocks); reserved_blocks);
ext4_superblock_csum_set(sb);
unlock_buffer(sbi->s_sbh);
/* Update the free space counts */ /* Update the free space counts */
percpu_counter_add(&sbi->s_freeclusters_counter, percpu_counter_add(&sbi->s_freeclusters_counter,
@@ -1474,6 +1472,8 @@ static void ext4_update_super(struct super_block *sb,
ext4_calculate_overhead(sb); ext4_calculate_overhead(sb);
es->s_overhead_clusters = cpu_to_le32(sbi->s_overhead); es->s_overhead_clusters = cpu_to_le32(sbi->s_overhead);
ext4_superblock_csum_set(sb);
unlock_buffer(sbi->s_sbh);
if (test_opt(sb, DEBUG)) if (test_opt(sb, DEBUG))
printk(KERN_DEBUG "EXT4-fs: added group %u:" printk(KERN_DEBUG "EXT4-fs: added group %u:"
"%llu blocks(%llu free %llu reserved)\n", flex_gd->count, "%llu blocks(%llu free %llu reserved)\n", flex_gd->count,

View File

@@ -793,6 +793,9 @@ static int bpf_send_signal_common(u32 sig, enum pid_type type)
return -EPERM; return -EPERM;
if (unlikely(!nmi_uaccess_okay())) if (unlikely(!nmi_uaccess_okay()))
return -EPERM; return -EPERM;
/* Task should not be pid=1 to avoid kernel panic. */
if (unlikely(is_global_init(current)))
return -EPERM;
if (irqs_disabled()) { if (irqs_disabled()) {
/* Do an early check on signal validity. Otherwise, /* Do an early check on signal validity. Otherwise,

View File

@@ -4415,6 +4415,19 @@ static void hci_sync_conn_complete_evt(struct hci_dev *hdev,
struct hci_ev_sync_conn_complete *ev = (void *) skb->data; struct hci_ev_sync_conn_complete *ev = (void *) skb->data;
struct hci_conn *conn; struct hci_conn *conn;
switch (ev->link_type) {
case SCO_LINK:
case ESCO_LINK:
break;
default:
/* As per Core 5.3 Vol 4 Part E 7.7.35 (p.2219), Link_Type
* for HCI_Synchronous_Connection_Complete is limited to
* either SCO or eSCO
*/
bt_dev_err(hdev, "Ignoring connect complete event for invalid link type");
return;
}
BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); BT_DBG("%s status 0x%2.2x", hdev->name, ev->status);
hci_dev_lock(hdev); hci_dev_lock(hdev);

View File

@@ -3886,7 +3886,7 @@ struct sk_buff *skb_segment_list(struct sk_buff *skb,
skb_shinfo(skb)->frag_list = NULL; skb_shinfo(skb)->frag_list = NULL;
do { while (list_skb) {
nskb = list_skb; nskb = list_skb;
list_skb = list_skb->next; list_skb = list_skb->next;
@@ -3932,8 +3932,7 @@ struct sk_buff *skb_segment_list(struct sk_buff *skb,
if (skb_needs_linearize(nskb, features) && if (skb_needs_linearize(nskb, features) &&
__skb_linearize(nskb)) __skb_linearize(nskb))
goto err_linearize; goto err_linearize;
}
} while (list_skb);
skb->truesize = skb->truesize - delta_truesize; skb->truesize = skb->truesize - delta_truesize;
skb->data_len = skb->data_len - delta_len; skb->data_len = skb->data_len - delta_len;

View File

@@ -294,6 +294,11 @@ static void mctp_sk_unhash(struct sock *sk)
synchronize_rcu(); synchronize_rcu();
} }
static void mctp_sk_destruct(struct sock *sk)
{
skb_queue_purge(&sk->sk_receive_queue);
}
static struct proto mctp_proto = { static struct proto mctp_proto = {
.name = "MCTP", .name = "MCTP",
.owner = THIS_MODULE, .owner = THIS_MODULE,
@@ -330,6 +335,7 @@ static int mctp_pf_create(struct net *net, struct socket *sock,
return -ENOMEM; return -ENOMEM;
sock_init_data(sock, sk); sock_init_data(sock, sk);
sk->sk_destruct = mctp_sk_destruct;
rc = 0; rc = 0;
if (sk->sk_prot->init) if (sk->sk_prot->init)

View File

@@ -108,7 +108,9 @@ int vscnprintf(char *buf, size_t size, const char *fmt, va_list args);
int scnprintf(char * buf, size_t size, const char * fmt, ...); int scnprintf(char * buf, size_t size, const char * fmt, ...);
int scnprintf_pad(char * buf, size_t size, const char * fmt, ...); int scnprintf_pad(char * buf, size_t size, const char * fmt, ...);
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
#endif
/* /*
* This looks more complex than it should be. But we need to * This looks more complex than it should be. But we need to

View File

@@ -48,6 +48,25 @@
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
#endif
/*
* gcc cpuid.h provides __cpuid_count() since v4.4.
* Clang/LLVM cpuid.h provides __cpuid_count() since v3.4.0.
*
* Provide local define for tests needing __cpuid_count() because
* selftests need to work in older environments that do not yet
* have __cpuid_count().
*/
#ifndef __cpuid_count
#define __cpuid_count(level, count, a, b, c, d) \
__asm__ __volatile__ ("cpuid\n\t" \
: "=a" (a), "=b" (b), "=c" (c), "=d" (d) \
: "0" (level), "2" (count))
#endif
/* define kselftest exit codes */ /* define kselftest exit codes */
#define KSFT_PASS 0 #define KSFT_PASS 0
#define KSFT_FAIL 1 #define KSFT_FAIL 1

View File

@@ -671,7 +671,9 @@
#define EXPECT_STRNE(expected, seen) \ #define EXPECT_STRNE(expected, seen) \
__EXPECT_STR(expected, seen, !=, 0) __EXPECT_STR(expected, seen, !=, 0)
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
#endif
/* Support an optional handler after and ASSERT_* or EXPECT_*. The approach is /* Support an optional handler after and ASSERT_* or EXPECT_*. The approach is
* not thread-safe, but it should be fine in most sane test scenarios. * not thread-safe, but it should be fine in most sane test scenarios.

View File

@@ -22,7 +22,6 @@
#define VALIDATION_DEFAULT_THRESHOLD 4 /* 4MB */ #define VALIDATION_DEFAULT_THRESHOLD 4 /* 4MB */
#define VALIDATION_NO_THRESHOLD 0 /* Verify the entire region */ #define VALIDATION_NO_THRESHOLD 0 /* Verify the entire region */
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#define MIN(X, Y) ((X) < (Y) ? (X) : (Y)) #define MIN(X, Y) ((X) < (Y) ? (X) : (Y))
struct config { struct config {

View File

@@ -13,6 +13,8 @@
#include <ucontext.h> #include <ucontext.h>
#include <sys/mman.h> #include <sys/mman.h>
#include "../kselftest.h"
/* Define some kernel-like types */ /* Define some kernel-like types */
#define u8 __u8 #define u8 __u8
#define u16 __u16 #define u16 __u16
@@ -175,7 +177,6 @@ static inline void __pkey_write_allow(int pkey, int do_allow_write)
dprintf4("pkey_reg now: %016llx\n", read_pkey_reg()); dprintf4("pkey_reg now: %016llx\n", read_pkey_reg());
} }
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
#define ALIGN_UP(x, align_to) (((x) + ((align_to)-1)) & ~((align_to)-1)) #define ALIGN_UP(x, align_to) (((x) + ((align_to)-1)) & ~((align_to)-1))
#define ALIGN_DOWN(x, align_to) ((x) & ~((align_to)-1)) #define ALIGN_DOWN(x, align_to) ((x) & ~((align_to)-1))
#define ALIGN_PTR_UP(p, ptr_align_to) \ #define ALIGN_PTR_UP(p, ptr_align_to) \

View File

@@ -9,7 +9,7 @@
#include <sys/mman.h> #include <sys/mman.h>
#include <string.h> #include <string.h>
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) #include "../kselftest.h"
#ifdef __powerpc64__ #ifdef __powerpc64__
#define PAGE_SIZE (64 << 10) #define PAGE_SIZE (64 << 10)