* Re: [PATCH v2 0/5] Support for generalized use of make C={1,2} via a wrapper program
From: Bart Van Assche @ 2017-12-18 17:56 UTC (permalink / raw)
To: joe@perches.com, jgg@ziepe.ca
Cc: corbet@lwn.net, linux-kernel@vger.kernel.org,
keescook@chromium.org, linux-rdma@vger.kernel.org,
linux-doc@vger.kernel.org, willy@infradead.org,
knut.omang@oracle.com, nicolas.palix@imag.fr,
asmund.ostvold@oracle.com, john.haxby@oracle.com,
alexander.levin@verizon.com, mchehab@kernel.org,
haakon.bugge@oracle.com, michal.lkml@markovi.net,
Gilles.Muller@lip6.fr, "yama
In-Reply-To: <20171218174604.GA19056@ziepe.ca>
On Mon, 2017-12-18 at 10:46 -0700, Jason Gunthorpe wrote:
> On Sun, Dec 17, 2017 at 10:00:17PM -0800, Joe Perches wrote:
>
> > > Today when we run checkers we get so many warnings it is too hard to
> > > make any sense of it.
> >
> > Here is a list of the checkpatch messages for drivers/infiniband
> > sorted by type.
> >
> > Many of these might be corrected by using
> >
> > $ ./scripts/checkpatch.pl -f --fix-inplace --types=<TYPE> \
> > $(git ls-files drivers/infiniband/)
>
> How many of these do you think it is worth to fix?
>
> We do get a steady trickle of changes in this topic every cycle.
>
> Is it better to just do a big number of them all at once? Do you have
> an idea how disruptive this kind of work is to the whole patch flow
> eg new patches no longer applying to for-next, backports no longer
> applying, merge conflicts?
In my opinion patches that only change the coding style and do not change any
functionality are annoying. Before posting a patch that fixes a bug the change
history (git log -p) has to be cheched to figure out which patch introduced
the bug. Patches that only change coding style pollute the change history.
Bart.
^ permalink raw reply
* [PATCH bpf-next] bpf: arm64: fix uninitialized variable
From: Alexei Starovoitov @ 2017-12-18 18:09 UTC (permalink / raw)
To: David S . Miller; +Cc: Daniel Borkmann, Arnd Bergmann, netdev, kernel-team
From: Alexei Starovoitov <ast@fb.com>
fix the following issue:
arch/arm64/net/bpf_jit_comp.c: In function 'bpf_int_jit_compile':
arch/arm64/net/bpf_jit_comp.c:982:18: error: 'image_size' may be used
uninitialized in this function [-Werror=maybe-uninitialized]
Fixes: db496944fdaa ("bpf: arm64: add JIT support for multi-function programs")
Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
---
arch/arm64/net/bpf_jit_comp.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c
index 396490cf7316..acaa935ed977 100644
--- a/arch/arm64/net/bpf_jit_comp.c
+++ b/arch/arm64/net/bpf_jit_comp.c
@@ -897,6 +897,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
image_ptr = jit_data->image;
header = jit_data->header;
extra_pass = true;
+ image_size = sizeof(u32) * ctx.idx;
goto skip_init_ctx;
}
memset(&ctx, 0, sizeof(ctx));
--
2.9.5
^ permalink raw reply related
* [PATCH net-next] bpf/cgroup: fix a verification error for a CGROUP_DEVICE type prog
From: Yonghong Song @ 2017-12-18 18:13 UTC (permalink / raw)
To: ast, daniel, netdev; +Cc: guro, kernel-team
The tools/testing/selftests/bpf test program
test_dev_cgroup fails with the following error
when compiled with llvm 6.0. (I did not try
with earlier versions.)
libbpf: load bpf program failed: Permission denied
libbpf: -- BEGIN DUMP LOG ---
libbpf:
0: (61) r2 = *(u32 *)(r1 +4)
1: (b7) r0 = 0
2: (55) if r2 != 0x1 goto pc+8
R0=inv0 R1=ctx(id=0,off=0,imm=0) R2=inv1 R10=fp0
3: (69) r2 = *(u16 *)(r1 +0)
invalid bpf_context access off=0 size=2
...
The culprit is the following statement in dev_cgroup.c:
short type = ctx->access_type & 0xFFFF;
This code is typical as the ctx->access_type is assigned
as below in kernel/bpf/cgroup.c:
struct bpf_cgroup_dev_ctx ctx = {
.access_type = (access << 16) | dev_type,
.major = major,
.minor = minor,
};
The compiler converts it to u16 access while
the verifier cgroup_dev_is_valid_access rejects
any non u32 access.
This patch permits the field access_type to be accessible
with type u16 and u8 as well.
Signed-off-by: Yonghong Song <yhs@fb.com>
Tested-by: Roman Gushchin <guro@fb.com>
---
include/uapi/linux/bpf.h | 3 ++-
kernel/bpf/cgroup.c | 15 +++++++++++++--
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index 80d62e8..6aa60d4 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -1001,7 +1001,8 @@ struct bpf_perf_event_value {
#define BPF_DEVCG_DEV_CHAR (1ULL << 1)
struct bpf_cgroup_dev_ctx {
- __u32 access_type; /* (access << 16) | type */
+ /* access_type encoded as (BPF_DEVCG_ACC_* << 16) | BPF_DEVCG_DEV_* */
+ __u32 access_type;
__u32 major;
__u32 minor;
};
diff --git a/kernel/bpf/cgroup.c b/kernel/bpf/cgroup.c
index b789ab7..c1c0b60 100644
--- a/kernel/bpf/cgroup.c
+++ b/kernel/bpf/cgroup.c
@@ -568,6 +568,8 @@ static bool cgroup_dev_is_valid_access(int off, int size,
enum bpf_access_type type,
struct bpf_insn_access_aux *info)
{
+ const int size_default = sizeof(__u32);
+
if (type == BPF_WRITE)
return false;
@@ -576,8 +578,17 @@ static bool cgroup_dev_is_valid_access(int off, int size,
/* The verifier guarantees that size > 0. */
if (off % size != 0)
return false;
- if (size != sizeof(__u32))
- return false;
+
+ switch (off) {
+ case bpf_ctx_range(struct bpf_cgroup_dev_ctx, access_type):
+ bpf_ctx_record_field_size(info, size_default);
+ if (!bpf_ctx_narrow_access_ok(off, size, size_default))
+ return false;
+ break;
+ default:
+ if (size != size_default)
+ return false;
+ }
return true;
}
--
2.9.5
^ permalink raw reply related
* Re: [PATCH net-next 0/6] sfc: Initial X2000-series (Medford2) support
From: David Miller @ 2017-12-18 18:16 UTC (permalink / raw)
To: ecree; +Cc: linux-net-drivers, netdev
In-Reply-To: <f9e1279b-03d0-729c-2518-c1e204444447@solarflare.com>
From: Edward Cree <ecree@solarflare.com>
Date: Mon, 18 Dec 2017 16:54:29 +0000
> Basic PCI-level changes to support X2000-series NICs.
> Also fix unexpected-PTP-event log messages, since the timestamp format has
> been changed in these NICs and that causes us to fail to probe PTP (but we
> still get the PPS events).
Series applied.
^ permalink raw reply
* Re: [net 1/1] tipc: fix lost member events bug
From: David Miller @ 2017-12-18 18:17 UTC (permalink / raw)
To: jon.maloy
Cc: netdev, mohan.krishna.ghanta.krishnamurthy, tung.q.nguyen,
hoang.h.le, canh.d.luu, ying.xue, tipc-discussion
In-Reply-To: <1513614856-9857-1-git-send-email-jon.maloy@ericsson.com>
From: Jon Maloy <jon.maloy@ericsson.com>
Date: Mon, 18 Dec 2017 17:34:16 +0100
> Group messages are not supposed to be returned to sender when the
> destination socket disappears. This is done correctly for regular
> traffic messages, by setting the 'dest_droppable' bit in the header.
> But we forget to do that in group protocol messages. This has the effect
> that such messages may sometimes bounce back to the sender, be perceived
> as a legitimate peer message, and wreak general havoc for the rest of
> the session. In particular, we have seen that a member in state LEAVING
> may go back to state RECLAIMED or REMITTED, hence causing suppression
> of an otherwise expected 'member down' event to the user.
>
> We fix this by setting the 'dest_droppable' bit even in group protocol
> messages.
>
> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Applied.
^ permalink raw reply
* Re: [net 1/1] tipc: remove leaving group member from all lists
From: David Miller @ 2017-12-18 18:17 UTC (permalink / raw)
To: jon.maloy
Cc: netdev, mohan.krishna.ghanta.krishnamurthy, tung.q.nguyen,
hoang.h.le, canh.d.luu, ying.xue, tipc-discussion
In-Reply-To: <1513617214-15464-1-git-send-email-jon.maloy@ericsson.com>
From: Jon Maloy <jon.maloy@ericsson.com>
Date: Mon, 18 Dec 2017 18:13:34 +0100
> A group member going into state LEAVING should never go back to any
> other state before it is finally deleted. However, this might happen
> if the socket needs to send out a RECLAIM message during this interval.
> Since we forget to remove the leaving member from the group's 'active'
> or 'pending' list, the member might be selected for reclaiming, change
> state to RECLAIMING, and get stuck in this state instead of being
> deleted. This might lead to suppression of the expected 'member down'
> event to the receiver.
>
> We fix this by removing the member from all lists, except the RB tree,
> at the moment it goes into state LEAVING.
>
> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Also applied, thanks Jon.
^ permalink raw reply
* Re: [trivial PATCH] treewide: Align function definition open/close braces
From: Rafael J. Wysocki @ 2017-12-18 18:19 UTC (permalink / raw)
To: Joe Perches
Cc: linux-rtc, alsa-devel, linuxppc-dev, Jiri Kosina, linux-scsi,
MPT-FusionLinux.pdl, acpi4asus-user, linux-wireless, linux-kernel,
dri-devel, platform-driver-x86, linux-xfs, linux-acpi,
linux-audit, amd-gfx, netdev, linux-fsdevel, Linus Torvalds,
ocfs2-devel, linux-media
In-Reply-To: <1513556924.31581.51.camel@perches.com>
On Monday, December 18, 2017 1:28:44 AM CET Joe Perches wrote:
> Some functions definitions have either the initial open brace and/or
> the closing brace outside of column 1.
>
> Move those braces to column 1.
>
> This allows various function analyzers like gnu complexity to work
> properly for these modified functions.
>
> Miscellanea:
>
> o Remove extra trailing ; and blank line from xfs_agf_verify
>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> git diff -w shows no difference other than the above 'Miscellanea'
>
> (this is against -next, but it applies against Linus' tree
> with a couple offsets)
>
> arch/x86/include/asm/atomic64_32.h | 2 +-
> drivers/acpi/custom_method.c | 2 +-
> drivers/acpi/fan.c | 2 +-
> drivers/gpu/drm/amd/display/dc/core/dc.c | 2 +-
> drivers/media/i2c/msp3400-kthreads.c | 2 +-
> drivers/message/fusion/mptsas.c | 2 +-
> drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c | 2 +-
> drivers/net/wireless/ath/ath9k/xmit.c | 2 +-
> drivers/platform/x86/eeepc-laptop.c | 2 +-
> drivers/rtc/rtc-ab-b5ze-s3.c | 2 +-
> drivers/scsi/dpt_i2o.c | 2 +-
> drivers/scsi/sym53c8xx_2/sym_glue.c | 2 +-
> fs/locks.c | 2 +-
> fs/ocfs2/stack_user.c | 2 +-
> fs/xfs/libxfs/xfs_alloc.c | 5 ++---
> fs/xfs/xfs_export.c | 2 +-
> kernel/audit.c | 6 +++---
> kernel/trace/trace_printk.c | 4 ++--
> lib/raid6/sse2.c | 14 +++++++-------
> sound/soc/fsl/fsl_dma.c | 2 +-
> 20 files changed, 30 insertions(+), 31 deletions(-)
>
> diff --git a/arch/x86/include/asm/atomic64_32.h b/arch/x86/include/asm/atomic64_32.h
> index 97c46b8169b7..d4d4883080fa 100644
> --- a/arch/x86/include/asm/atomic64_32.h
> +++ b/arch/x86/include/asm/atomic64_32.h
> @@ -122,7 +122,7 @@ static inline long long atomic64_read(const atomic64_t *v)
> long long r;
> alternative_atomic64(read, "=&A" (r), "c" (v) : "memory");
> return r;
> - }
> +}
>
> /**
> * atomic64_add_return - add and return
> diff --git a/drivers/acpi/custom_method.c b/drivers/acpi/custom_method.c
> index c68e72414a67..e967c1173ba3 100644
> --- a/drivers/acpi/custom_method.c
> +++ b/drivers/acpi/custom_method.c
> @@ -94,7 +94,7 @@ static void __exit acpi_custom_method_exit(void)
> {
> if (cm_dentry)
> debugfs_remove(cm_dentry);
> - }
> +}
>
> module_init(acpi_custom_method_init);
> module_exit(acpi_custom_method_exit);
> diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c
> index 6cf4988206f2..3563103590c6 100644
> --- a/drivers/acpi/fan.c
> +++ b/drivers/acpi/fan.c
> @@ -219,7 +219,7 @@ fan_set_cur_state(struct thermal_cooling_device *cdev, unsigned long state)
> return fan_set_state_acpi4(device, state);
> else
> return fan_set_state(device, state);
> - }
> +}
>
> static const struct thermal_cooling_device_ops fan_cooling_ops = {
> .get_max_state = fan_get_max_state,
> diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
> index d1488d5ee028..1e0d1e7c5324 100644
> --- a/drivers/gpu/drm/amd/display/dc/core/dc.c
> +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
> @@ -461,7 +461,7 @@ static void disable_dangling_plane(struct dc *dc, struct dc_state *context)
> ******************************************************************************/
>
> struct dc *dc_create(const struct dc_init_data *init_params)
> - {
> +{
> struct dc *dc = kzalloc(sizeof(*dc), GFP_KERNEL);
> unsigned int full_pipe_count;
>
> diff --git a/drivers/media/i2c/msp3400-kthreads.c b/drivers/media/i2c/msp3400-kthreads.c
> index 4dd01e9f553b..dc6cb8d475b3 100644
> --- a/drivers/media/i2c/msp3400-kthreads.c
> +++ b/drivers/media/i2c/msp3400-kthreads.c
> @@ -885,7 +885,7 @@ static int msp34xxg_modus(struct i2c_client *client)
> }
>
> static void msp34xxg_set_source(struct i2c_client *client, u16 reg, int in)
> - {
> +{
> struct msp_state *state = to_state(i2c_get_clientdata(client));
> int source, matrix;
>
> diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
> index 345f6035599e..69a62d23514b 100644
> --- a/drivers/message/fusion/mptsas.c
> +++ b/drivers/message/fusion/mptsas.c
> @@ -2968,7 +2968,7 @@ mptsas_exp_repmanufacture_info(MPT_ADAPTER *ioc,
> mutex_unlock(&ioc->sas_mgmt.mutex);
> out:
> return ret;
> - }
> +}
>
> static void
> mptsas_parse_device_info(struct sas_identify *identify,
> diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
> index 3dd973475125..0ea141ece19e 100644
> --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
> +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
> @@ -603,7 +603,7 @@ static struct uni_table_desc *nx_get_table_desc(const u8 *unirom, int section)
>
> static int
> netxen_nic_validate_header(struct netxen_adapter *adapter)
> - {
> +{
> const u8 *unirom = adapter->fw->data;
> struct uni_table_desc *directory = (struct uni_table_desc *) &unirom[0];
> u32 fw_file_size = adapter->fw->size;
> diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
> index bd438062a6db..baedc7186b10 100644
> --- a/drivers/net/wireless/ath/ath9k/xmit.c
> +++ b/drivers/net/wireless/ath/ath9k/xmit.c
> @@ -196,7 +196,7 @@ ath_tid_pull(struct ath_atx_tid *tid)
> }
>
> return skb;
> - }
> +}
>
> static struct sk_buff *ath_tid_dequeue(struct ath_atx_tid *tid)
> {
> diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
> index 5a681962899c..4c38904a8a32 100644
> --- a/drivers/platform/x86/eeepc-laptop.c
> +++ b/drivers/platform/x86/eeepc-laptop.c
> @@ -492,7 +492,7 @@ static void eeepc_platform_exit(struct eeepc_laptop *eeepc)
> * potentially bad time, such as a timer interrupt.
> */
> static void tpd_led_update(struct work_struct *work)
> - {
> +{
> struct eeepc_laptop *eeepc;
>
> eeepc = container_of(work, struct eeepc_laptop, tpd_led_work);
> diff --git a/drivers/rtc/rtc-ab-b5ze-s3.c b/drivers/rtc/rtc-ab-b5ze-s3.c
> index a319bf1e49de..ef5c16dfabfa 100644
> --- a/drivers/rtc/rtc-ab-b5ze-s3.c
> +++ b/drivers/rtc/rtc-ab-b5ze-s3.c
> @@ -648,7 +648,7 @@ static int abb5zes3_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
> ret);
>
> return ret;
> - }
> +}
>
> /* Enable or disable battery low irq generation */
> static inline int _abb5zes3_rtc_battery_low_irq_enable(struct regmap *regmap,
> diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
> index fd172b0890d3..a00d822e3142 100644
> --- a/drivers/scsi/dpt_i2o.c
> +++ b/drivers/scsi/dpt_i2o.c
> @@ -3524,7 +3524,7 @@ static int adpt_i2o_systab_send(adpt_hba* pHba)
> #endif
>
> return ret;
> - }
> +}
>
>
> /*============================================================================
> diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c
> index 791a2182de53..7320d5fe4cbc 100644
> --- a/drivers/scsi/sym53c8xx_2/sym_glue.c
> +++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
> @@ -1393,7 +1393,7 @@ static struct Scsi_Host *sym_attach(struct scsi_host_template *tpnt, int unit,
> scsi_host_put(shost);
>
> return NULL;
> - }
> +}
>
>
> /*
> diff --git a/fs/locks.c b/fs/locks.c
> index 21b4dfa289ee..d2399d001afe 100644
> --- a/fs/locks.c
> +++ b/fs/locks.c
> @@ -559,7 +559,7 @@ static const struct lock_manager_operations lease_manager_ops = {
> * Initialize a lease, use the default lock manager operations
> */
> static int lease_init(struct file *filp, long type, struct file_lock *fl)
> - {
> +{
> if (assign_type(fl, type) != 0)
> return -EINVAL;
>
> diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c
> index dae9eb7c441e..d2fb97b173da 100644
> --- a/fs/ocfs2/stack_user.c
> +++ b/fs/ocfs2/stack_user.c
> @@ -398,7 +398,7 @@ static int ocfs2_control_do_setnode_msg(struct file *file,
>
> static int ocfs2_control_do_setversion_msg(struct file *file,
> struct ocfs2_control_message_setv *msg)
> - {
> +{
> long major, minor;
> char *ptr = NULL;
> struct ocfs2_control_private *p = file->private_data;
> diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c
> index 0da80019a917..217108f765d5 100644
> --- a/fs/xfs/libxfs/xfs_alloc.c
> +++ b/fs/xfs/libxfs/xfs_alloc.c
> @@ -2401,7 +2401,7 @@ static bool
> xfs_agf_verify(
> struct xfs_mount *mp,
> struct xfs_buf *bp)
> - {
> +{
> struct xfs_agf *agf = XFS_BUF_TO_AGF(bp);
>
> if (xfs_sb_version_hascrc(&mp->m_sb)) {
> @@ -2449,8 +2449,7 @@ xfs_agf_verify(
> be32_to_cpu(agf->agf_refcount_level) > XFS_BTREE_MAXLEVELS))
> return false;
>
> - return true;;
> -
> + return true;
> }
>
> static void
> diff --git a/fs/xfs/xfs_export.c b/fs/xfs/xfs_export.c
> index fe1bfee35898..7d5c355d78b5 100644
> --- a/fs/xfs/xfs_export.c
> +++ b/fs/xfs/xfs_export.c
> @@ -122,7 +122,7 @@ xfs_nfs_get_inode(
> struct super_block *sb,
> u64 ino,
> u32 generation)
> - {
> +{
> xfs_mount_t *mp = XFS_M(sb);
> xfs_inode_t *ip;
> int error;
> diff --git a/kernel/audit.c b/kernel/audit.c
> index 227db99b0f19..d97e8f0f73ca 100644
> --- a/kernel/audit.c
> +++ b/kernel/audit.c
> @@ -443,15 +443,15 @@ static int audit_set_failure(u32 state)
> * Drop any references inside the auditd connection tracking struct and free
> * the memory.
> */
> - static void auditd_conn_free(struct rcu_head *rcu)
> - {
> +static void auditd_conn_free(struct rcu_head *rcu)
> +{
> struct auditd_connection *ac;
>
> ac = container_of(rcu, struct auditd_connection, rcu);
> put_pid(ac->pid);
> put_net(ac->net);
> kfree(ac);
> - }
> +}
>
> /**
> * auditd_set - Set/Reset the auditd connection state
> diff --git a/kernel/trace/trace_printk.c b/kernel/trace/trace_printk.c
> index ad1d6164e946..50f44b7b2b32 100644
> --- a/kernel/trace/trace_printk.c
> +++ b/kernel/trace/trace_printk.c
> @@ -196,7 +196,7 @@ struct notifier_block module_trace_bprintk_format_nb = {
> };
>
> int __trace_bprintk(unsigned long ip, const char *fmt, ...)
> - {
> +{
> int ret;
> va_list ap;
>
> @@ -214,7 +214,7 @@ int __trace_bprintk(unsigned long ip, const char *fmt, ...)
> EXPORT_SYMBOL_GPL(__trace_bprintk);
>
> int __ftrace_vbprintk(unsigned long ip, const char *fmt, va_list ap)
> - {
> +{
> if (unlikely(!fmt))
> return 0;
>
> diff --git a/lib/raid6/sse2.c b/lib/raid6/sse2.c
> index 1d2276b007ee..8191e1d0d2fb 100644
> --- a/lib/raid6/sse2.c
> +++ b/lib/raid6/sse2.c
> @@ -91,7 +91,7 @@ static void raid6_sse21_gen_syndrome(int disks, size_t bytes, void **ptrs)
>
> static void raid6_sse21_xor_syndrome(int disks, int start, int stop,
> size_t bytes, void **ptrs)
> - {
> +{
> u8 **dptr = (u8 **)ptrs;
> u8 *p, *q;
> int d, z, z0;
> @@ -200,9 +200,9 @@ static void raid6_sse22_gen_syndrome(int disks, size_t bytes, void **ptrs)
> kernel_fpu_end();
> }
>
> - static void raid6_sse22_xor_syndrome(int disks, int start, int stop,
> +static void raid6_sse22_xor_syndrome(int disks, int start, int stop,
> size_t bytes, void **ptrs)
> - {
> +{
> u8 **dptr = (u8 **)ptrs;
> u8 *p, *q;
> int d, z, z0;
> @@ -265,7 +265,7 @@ static void raid6_sse22_gen_syndrome(int disks, size_t bytes, void **ptrs)
>
> asm volatile("sfence" : : : "memory");
> kernel_fpu_end();
> - }
> +}
>
> const struct raid6_calls raid6_sse2x2 = {
> raid6_sse22_gen_syndrome,
> @@ -366,9 +366,9 @@ static void raid6_sse24_gen_syndrome(int disks, size_t bytes, void **ptrs)
> kernel_fpu_end();
> }
>
> - static void raid6_sse24_xor_syndrome(int disks, int start, int stop,
> +static void raid6_sse24_xor_syndrome(int disks, int start, int stop,
> size_t bytes, void **ptrs)
> - {
> +{
> u8 **dptr = (u8 **)ptrs;
> u8 *p, *q;
> int d, z, z0;
> @@ -471,7 +471,7 @@ static void raid6_sse24_gen_syndrome(int disks, size_t bytes, void **ptrs)
> }
> asm volatile("sfence" : : : "memory");
> kernel_fpu_end();
> - }
> +}
>
>
> const struct raid6_calls raid6_sse2x4 = {
> diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c
> index 0c11f434a374..ec619f51d336 100644
> --- a/sound/soc/fsl/fsl_dma.c
> +++ b/sound/soc/fsl/fsl_dma.c
> @@ -879,7 +879,7 @@ static const struct snd_pcm_ops fsl_dma_ops = {
> };
>
> static int fsl_soc_dma_probe(struct platform_device *pdev)
> - {
> +{
> struct dma_object *dma;
> struct device_node *np = pdev->dev.of_node;
> struct device_node *ssi_np;
>
> --
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
for the ACPI part.
Thanks!
^ permalink raw reply
* Re: [Patch v2] net: phy: marvell: Limit 88m1101 autoneg errata to 88E1145 as well.
From: David Miller @ 2017-12-18 18:19 UTC (permalink / raw)
To: qiang.zhao; +Cc: netdev
In-Reply-To: <20171218022643.47454-1-qiang.zhao@nxp.com>
From: Zhao Qiang <qiang.zhao@nxp.com>
Date: Mon, 18 Dec 2017 10:26:43 +0800
> 88E1145 also need this autoneg errata.
>
> Fixes: f2899788353c ("net: phy: marvell: Limit errata to 88m1101")
> Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
> ---
> Changes for v2
> - modify the commit msg in a proper way.
Applied and queued up for -stable.
^ permalink raw reply
* Re: [PATCH bpf-next] bpf: arm64: fix uninitialized variable
From: Daniel Borkmann @ 2017-12-18 18:19 UTC (permalink / raw)
To: Alexei Starovoitov, David S . Miller; +Cc: Arnd Bergmann, netdev, kernel-team
In-Reply-To: <20171218180944.3145591-1-ast@kernel.org>
On 12/18/2017 07:09 PM, Alexei Starovoitov wrote:
> From: Alexei Starovoitov <ast@fb.com>
>
> fix the following issue:
> arch/arm64/net/bpf_jit_comp.c: In function 'bpf_int_jit_compile':
> arch/arm64/net/bpf_jit_comp.c:982:18: error: 'image_size' may be used
> uninitialized in this function [-Werror=maybe-uninitialized]
>
> Fixes: db496944fdaa ("bpf: arm64: add JIT support for multi-function programs")
> Reported-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
> ---
> arch/arm64/net/bpf_jit_comp.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c
> index 396490cf7316..acaa935ed977 100644
> --- a/arch/arm64/net/bpf_jit_comp.c
> +++ b/arch/arm64/net/bpf_jit_comp.c
> @@ -897,6 +897,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
> image_ptr = jit_data->image;
> header = jit_data->header;
> extra_pass = true;
> + image_size = sizeof(u32) * ctx.idx;
> goto skip_init_ctx;
> }
> memset(&ctx, 0, sizeof(ctx));
>
I don't really mind, but it feels more complex than it needs to be
imho, since in the initial pass you fetch 'image_size' in fake pass
from ctx.idx, then we set ctx.idx to 0 again, do another pass and
use the cached ctx.idx from that second pass instead of the first
one where we set 'image_size' originally, so we definitely need to
take that into consideration in future reviews at least.
Thanks,
Daniel
^ permalink raw reply
* Re: [PATCH] net: qcom/emac: Change the order of mac up and sgmii open
From: David Miller @ 2017-12-18 18:22 UTC (permalink / raw)
To: hpuranik; +Cc: netdev, linux-kernel, timur
In-Reply-To: <1513576667-2967-1-git-send-email-hpuranik@codeaurora.org>
From: Hemanth Puranik <hpuranik@codeaurora.org>
Date: Mon, 18 Dec 2017 11:27:47 +0530
> This patch fixes the order of mac_up and sgmii_open for the
> reasons noted below:
>
> - If open takes more time(if the SGMII block is not responding or
> if we want to do some delay based task) in this situation we
> will hit NETDEV watchdog
> - The main reason : We should signal to upper layers that we are
> ready to receive packets "only" when the entire path is initialized
> not the other way around, this is followed in the reset path where
> we do mac_down, sgmii_reset and mac_up. This also makes the driver
> uniform across the reset and open paths.
> - In the future there may be need for delay based tasks to be done in
> sgmii open which will result in NETDEV watchdog
> - As per the documentation the order of init should be sgmii, mac, rings
> and DMA
>
> Signed-off-by: Hemanth Puranik <hpuranik@codeaurora.org>
Applied.
^ permalink raw reply
* Re: [PATCH net] sctp: fix the issue that a __u16 variable may overflow in sctp_ulpq_renege
From: David Miller @ 2017-12-18 18:22 UTC (permalink / raw)
To: lucien.xin; +Cc: netdev, linux-sctp, marcelo.leitner, nhorman
In-Reply-To: <047a7d68a197ff748b48eb8cda4b08fd5b9623fe.1513577245.git.lucien.xin@gmail.com>
From: Xin Long <lucien.xin@gmail.com>
Date: Mon, 18 Dec 2017 14:07:25 +0800
> Now when reneging events in sctp_ulpq_renege(), the variable freed
> could be increased by a __u16 value twice while freed is of __u16
> type. It means freed may overflow at the second addition.
>
> This patch is to fix it by using __u32 type for 'freed', while at
> it, also to remove 'if (chunk)' check, as all renege commands are
> generated in sctp_eat_data and it can't be NULL.
>
> Reported-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
> Signed-off-by: Xin Long <lucien.xin@gmail.com>
Applied.
^ permalink raw reply
* Re: [PATCH net] sctp: add SCTP_CID_RECONF conversion in sctp_cname
From: David Miller @ 2017-12-18 18:22 UTC (permalink / raw)
To: lucien.xin; +Cc: netdev, linux-sctp, marcelo.leitner, nhorman
In-Reply-To: <ae9172b7dc432d6092ab2bc061a0cf322a3939b5.1513577597.git.lucien.xin@gmail.com>
From: Xin Long <lucien.xin@gmail.com>
Date: Mon, 18 Dec 2017 14:13:17 +0800
> Whenever a new type of chunk is added, the corresp conversion in
> sctp_cname should be added. Otherwise, in some places, pr_debug
> will print it as "unknown chunk".
>
> Fixes: cc16f00f6529 ("sctp: add support for generating stream reconf ssn reset request chunk")
> Signed-off-by: Xin Long <lucien.xin@gmail.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next v3 0/7] net: phy: meson-gxl: clean-up and improvements
From: David Miller @ 2017-12-18 18:25 UTC (permalink / raw)
To: jbrunet
Cc: andrew, f.fainelli, khilman, netdev, linux-arm-kernel,
linux-amlogic, linux-kernel
In-Reply-To: <20171218094446.31912-1-jbrunet@baylibre.com>
From: Jerome Brunet <jbrunet@baylibre.com>
Date: Mon, 18 Dec 2017 10:44:39 +0100
> This patchset adds defines for the control registers and helpers to access
> the banked registers. The goal being to make it easier to understand what
> the driver actually does.
> Then CONFIG_A6 settings is removed since this statement was without effect
> Finally interrupt support is added, speeding things up a little
>
> This series has been tested on the libretech-cc and khadas VIM
>
> Changes since v2 [0]:
> Drop LPA corruption fix which has been merged through net. Apart from this,
> series remains the same.
>
> [0]: https://lkml.kernel.org/r/20171207142715.32578-1-jbrunet@baylibre.com
Series applied, thanks.
^ permalink raw reply
* Re: [PATCH net v2] net: bridge: fix early call to br_stp_change_bridge_id and plug newlink leaks
From: David Miller @ 2017-12-18 18:31 UTC (permalink / raw)
To: nikolay; +Cc: netdev, makita.toshiaki, roopa, stephen, avagin, bridge, idosch
In-Reply-To: <20171218153509.7822-1-nikolay@cumulusnetworks.com>
From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Date: Mon, 18 Dec 2017 17:35:09 +0200
> The early call to br_stp_change_bridge_id in bridge's newlink can cause
> a memory leak if an error occurs during the newlink because the fdb
> entries are not cleaned up if a different lladdr was specified, also
> another minor issue is that it generates fdb notifications with
> ifindex = 0. Another unrelated memory leak is the bridge sysfs entries
> which get added on NETDEV_REGISTER event, but are not cleaned up in the
> newlink error path. To remove this special case the call to
> br_stp_change_bridge_id is done after netdev register and we cleanup the
> bridge on changelink error via br_dev_delete to plug all leaks.
>
> This patch makes netlink bridge destruction on newlink error the same as
> dellink and ioctl del which is necessary since at that point we have a
> fully initialized bridge device.
>
> To reproduce the issue:
> $ ip l add br0 address 00:11:22:33:44:55 type bridge group_fwd_mask 1
> RTNETLINK answers: Invalid argument
>
> $ rmmod bridge
> [ 1822.142525] =============================================================================
> [ 1822.143640] BUG bridge_fdb_cache (Tainted: G O ): Objects remaining in bridge_fdb_cache on __kmem_cache_shutdown()
> [ 1822.144821] -----------------------------------------------------------------------------
...
> Fixes: 30313a3d5794 ("bridge: Handle IFLA_ADDRESS correctly when creating bridge device")
> Fixes: 5b8d5429daa0 ("bridge: netlink: register netdevice before executing changelink")
> Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
> ---
> v2: it's better to use br_dev_delete to clean up because the sysfs entries
> were leaked as well, basically we use it for the bridge fdb flush and sysfs
> entries delete
>
> Consequently this also would fix the null ptr deref due to the rhashtable
> not being initialized in net-next when br_stp_change_bridge_id is called.
Applied, but doing state changes after register_netdev() is always dicey.
I hope things go well if the device is brought up immediately during
that register_netdev() call and before the stp bridge ID setting is
done.
^ permalink raw reply
* Re: [PATCH bpf-next] bpf: arm64: fix uninitialized variable
From: Alexei Starovoitov @ 2017-12-18 18:36 UTC (permalink / raw)
To: Daniel Borkmann, Alexei Starovoitov, David S . Miller
Cc: Arnd Bergmann, netdev, kernel-team
In-Reply-To: <801f283e-293b-251d-1e81-3c08094e1d94@iogearbox.net>
On 12/18/17 10:19 AM, Daniel Borkmann wrote:
> On 12/18/2017 07:09 PM, Alexei Starovoitov wrote:
>> From: Alexei Starovoitov <ast@fb.com>
>>
>> fix the following issue:
>> arch/arm64/net/bpf_jit_comp.c: In function 'bpf_int_jit_compile':
>> arch/arm64/net/bpf_jit_comp.c:982:18: error: 'image_size' may be used
>> uninitialized in this function [-Werror=maybe-uninitialized]
>>
>> Fixes: db496944fdaa ("bpf: arm64: add JIT support for multi-function programs")
>> Reported-by: Arnd Bergmann <arnd@arndb.de>
>> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
>> ---
>> arch/arm64/net/bpf_jit_comp.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c
>> index 396490cf7316..acaa935ed977 100644
>> --- a/arch/arm64/net/bpf_jit_comp.c
>> +++ b/arch/arm64/net/bpf_jit_comp.c
>> @@ -897,6 +897,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
>> image_ptr = jit_data->image;
>> header = jit_data->header;
>> extra_pass = true;
>> + image_size = sizeof(u32) * ctx.idx;
>> goto skip_init_ctx;
>> }
>> memset(&ctx, 0, sizeof(ctx));
>>
>
> I don't really mind, but it feels more complex than it needs to be
> imho, since in the initial pass you fetch 'image_size' in fake pass
> from ctx.idx, then we set ctx.idx to 0 again, do another pass and
> use the cached ctx.idx from that second pass instead of the first
> one where we set 'image_size' originally, so we definitely need to
> take that into consideration in future reviews at least.
not sure what you mean.
This check: ctx.idx != jit_data->ctx.idx matters the most.
After first alloc the 'image_size' variable used for dumping only.
That's why the JITing itself worked fine. We could have removed it
since it's computable from idx, but imo it's fine this way.
^ permalink raw reply
* Re: [PATCH v2 0/5] Support for generalized use of make C={1,2} via a wrapper program
From: Knut Omang @ 2017-12-18 18:39 UTC (permalink / raw)
To: Bart Van Assche, joe@perches.com, jgg@ziepe.ca
Cc: corbet@lwn.net, linux-kernel@vger.kernel.org,
keescook@chromium.org, linux-rdma@vger.kernel.org,
linux-doc@vger.kernel.org, willy@infradead.org,
nicolas.palix@imag.fr, asmund.ostvold@oracle.com,
john.haxby@oracle.com, alexander.levin@verizon.com,
mchehab@kernel.org, haakon.bugge@oracle.com,
michal.lkml@markovi.net, Gilles.Muller@lip6.fr,
yamada.masahiro@socionext.com
In-Reply-To: <1513619815.2798.2.camel@wdc.com>
On Mon, 2017-12-18 at 17:56 +0000, Bart Van Assche wrote:
> On Mon, 2017-12-18 at 10:46 -0700, Jason Gunthorpe wrote:
> > On Sun, Dec 17, 2017 at 10:00:17PM -0800, Joe Perches wrote:
> >
> > > > Today when we run checkers we get so many warnings it is too hard to
> > > > make any sense of it.
> > >
> > > Here is a list of the checkpatch messages for drivers/infiniband
> > > sorted by type.
> > >
> > > Many of these might be corrected by using
> > >
> > > $ ./scripts/checkpatch.pl -f --fix-inplace --types=<TYPE> \
> > > $(git ls-files drivers/infiniband/)
> >
> > How many of these do you think it is worth to fix?
> >
> > We do get a steady trickle of changes in this topic every cycle.
> >
> > Is it better to just do a big number of them all at once? Do you have
> > an idea how disruptive this kind of work is to the whole patch flow
> > eg new patches no longer applying to for-next, backports no longer
> > applying, merge conflicts?
>
> In my opinion patches that only change the coding style and do not change any
> functionality are annoying. Before posting a patch that fixes a bug the change
> history (git log -p) has to be cheched to figure out which patch introduced
> the bug. Patches that only change coding style pollute the change history.
I agree with you - the problem is that style issues should not have existed.
But when they do it becomes a problem to remove them and a problem to
keep them - for instance us who try to be compliant by having style helpers
in our editor, we end up having to manually revert old style mistakes back in
to avoid making unrelated whitespace changes or similar.
I think what we get with this patch set is that there's a way to rein in the
issues and to enable some regression testing without enforcing a lot of work
or annoying history issues *right away*. That way this problem can be tackled when
appropriate for the subsystem in question, and the reason for holding back on
some changes can be documented in the local runchecks.cfg file, focusing
willing helping hands on the issues considered most important for that
subsystem.
Thanks,
Knut
^ permalink raw reply
* Re: [PATCH] ethtool: fix MFLCN register dump for 82599 and newer
From: John W. Linville @ 2017-12-18 18:38 UTC (permalink / raw)
To: Zhang Kang; +Cc: netdev, Gao Wayne, Wei Net
In-Reply-To: <20171215015651.6112-1-tjbroadroad@163.com>
On Fri, Dec 15, 2017 at 09:56:51AM +0800, Zhang Kang wrote:
> Use MFLCN for 82599 and X540 HW instead of FCTRL.
>
> Signed-off-by: Zhang Kang <tjbroadroad@163.com>
> Signed-off-by: Gao Wayne <Wayne.Gao@emc.com>
> Signed-off-by: Wei Net <gw_net@163.com>
Thanks, applied.
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
^ permalink raw reply
* [PATCH 0/2 net-next] ibmvnic: Fix and increase maximum TX/RX queues
From: Thomas Falcon @ 2017-12-18 18:52 UTC (permalink / raw)
To: netdev; +Cc: Thomas Falcon
This series renames IBMVNIC_MAX_TX_QUEUES to IBMVNIC_MAX_QUEUES since
it is used to allocate both RX and TX queues. The value is also increased
to accommodate newer hardware.
Thomas Falcon (2):
ibmvnic: Rename IBMVNIC_MAX_TX_QUEUES to IBMVNIC_MAX_QUEUES
ibmvnic: Increase maximum number of RX/TX queues
drivers/net/ethernet/ibm/ibmvnic.c | 2 +-
drivers/net/ethernet/ibm/ibmvnic.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
--
2.7.5
^ permalink raw reply
* [PATCH 1/2 net-next] ibmvnic: Rename IBMVNIC_MAX_TX_QUEUES to IBMVNIC_MAX_QUEUES
From: Thomas Falcon @ 2017-12-18 18:52 UTC (permalink / raw)
To: netdev; +Cc: Thomas Falcon
In-Reply-To: <1513623132-16554-1-git-send-email-tlfalcon@linux.vnet.ibm.com>
This value denotes the maximum number of TX queues but is used
to allocate both RX and TX queues.
Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
---
drivers/net/ethernet/ibm/ibmvnic.c | 2 +-
drivers/net/ethernet/ibm/ibmvnic.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 1dc4aef..df6d911 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -4285,7 +4285,7 @@ static int ibmvnic_probe(struct vio_dev *dev, const struct vio_device_id *id)
}
netdev = alloc_etherdev_mq(sizeof(struct ibmvnic_adapter),
- IBMVNIC_MAX_TX_QUEUES);
+ IBMVNIC_MAX_QUEUES);
if (!netdev)
return -ENOMEM;
diff --git a/drivers/net/ethernet/ibm/ibmvnic.h b/drivers/net/ethernet/ibm/ibmvnic.h
index 4487f1e..0f8ef61 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.h
+++ b/drivers/net/ethernet/ibm/ibmvnic.h
@@ -39,7 +39,7 @@
#define IBMVNIC_RX_WEIGHT 16
/* when changing this, update IBMVNIC_IO_ENTITLEMENT_DEFAULT */
#define IBMVNIC_BUFFS_PER_POOL 100
-#define IBMVNIC_MAX_TX_QUEUES 5
+#define IBMVNIC_MAX_QUEUES 5
#define IBMVNIC_TSO_BUF_SZ 65536
#define IBMVNIC_TSO_BUFS 64
--
2.7.5
^ permalink raw reply related
* [PATCH 2/2 net-next] ibmvnic: Increase maximum number of RX/TX queues
From: Thomas Falcon @ 2017-12-18 18:52 UTC (permalink / raw)
To: netdev; +Cc: Thomas Falcon
In-Reply-To: <1513623132-16554-1-git-send-email-tlfalcon@linux.vnet.ibm.com>
Increase the number of queues allocated to accommodate recent
network adapter inclusions on the IBM vNIC platform.
Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
---
drivers/net/ethernet/ibm/ibmvnic.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/ibm/ibmvnic.h b/drivers/net/ethernet/ibm/ibmvnic.h
index 0f8ef61..2df79fd 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.h
+++ b/drivers/net/ethernet/ibm/ibmvnic.h
@@ -39,7 +39,7 @@
#define IBMVNIC_RX_WEIGHT 16
/* when changing this, update IBMVNIC_IO_ENTITLEMENT_DEFAULT */
#define IBMVNIC_BUFFS_PER_POOL 100
-#define IBMVNIC_MAX_QUEUES 5
+#define IBMVNIC_MAX_QUEUES 10
#define IBMVNIC_TSO_BUF_SZ 65536
#define IBMVNIC_TSO_BUFS 64
--
2.7.5
^ permalink raw reply related
* [PATCH net-next] ibmvnic: Include header descriptor support for ARP packets
From: Thomas Falcon @ 2017-12-18 18:52 UTC (permalink / raw)
To: netdev; +Cc: Thomas Falcon
In recent tests with new adapters, it was discovered that ARP
packets were not being properly processed. This patch adds
support for ARP packet headers to be passed to backing adapters,
if necessary.
Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
---
drivers/net/ethernet/ibm/ibmvnic.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index df6d911..6911b7c 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -59,6 +59,7 @@
#include <linux/mm.h>
#include <linux/ethtool.h>
#include <linux/proc_fs.h>
+#include <linux/if_arp.h>
#include <linux/in.h>
#include <linux/ip.h>
#include <linux/ipv6.h>
@@ -1153,6 +1154,9 @@ static int build_hdr_data(u8 hdr_field, struct sk_buff *skb,
hdr_len[2] = tcp_hdrlen(skb);
else if (ipv6_hdr(skb)->nexthdr == IPPROTO_UDP)
hdr_len[2] = sizeof(struct udphdr);
+ } else if (skb->protocol == htons(ETH_P_ARP)) {
+ hdr_len[1] = arp_hdr_len(skb->dev);
+ hdr_len[2] = 0;
}
memset(hdr_data, 0, 120);
@@ -1386,7 +1390,8 @@ static int ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev)
/* determine if l2/3/4 headers are sent to firmware */
if ((*hdrs >> 7) & 1 &&
(skb->protocol == htons(ETH_P_IP) ||
- skb->protocol == htons(ETH_P_IPV6))) {
+ skb->protocol == htons(ETH_P_IPV6) ||
+ skb->protocol == htons(ETH_P_ARP))) {
build_hdr_descs_arr(tx_buff, &num_entries, *hdrs);
tx_crq.v1.n_crq_elem = num_entries;
tx_buff->indir_arr[0] = tx_crq;
--
2.7.5
^ permalink raw reply related
* [PATCH iproute2 0/3] Improve iplink index, alias and name parameters handling
From: Serhey Popovych @ 2017-12-18 18:54 UTC (permalink / raw)
To: netdev
In this series I present following improvements:
1) Check index is greather than zero and forbid
specifying it multiple times in iplink_parse().
Use 0 instead of -1 as special value in iplink_modify().
2) Do not stop parameters processing after alias given.
Check alias length does not exceed IFALIASZ - 1.
3) Drop redundant name parameter length checks in
iplink_vxcan.c and link_veth.c.
See individual patch description message for details.
Thanks,
Serhii
Serhey Popovych (3):
iplink: Improve index parameter handling
iplink: Process "alias" parameter correctly
iplink: Kill redundant network device name checks
ip/iplink.c | 21 ++++++++++-----------
ip/iplink_vxcan.c | 8 +++-----
ip/link_veth.c | 8 +++-----
3 files changed, 16 insertions(+), 21 deletions(-)
--
1.7.10.4
^ permalink raw reply
* [PATCH iproute2 1/3] iplink: Improve index parameter handling
From: Serhey Popovych @ 2017-12-18 18:54 UTC (permalink / raw)
To: netdev
In-Reply-To: <1513623248-7689-1-git-send-email-serhe.popovych@gmail.com>
Correctly check for valid network device index supplied on
command line: indexes are always greather than zero. Check
for duplicate "index" argument.
Initialize @index to 0 to simplify handling it in iplink_modify().
Other callers (link_veth.c, iplink_vxcan.c) already did so.
No need to initialize ifi_index with 0 since it is already
initialized at the @struct req initialization time and not
modified in iplink_parse().
Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
---
ip/iplink.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/ip/iplink.c b/ip/iplink.c
index 1e685cc..4f9c169 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -586,8 +586,10 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
*name = *argv;
} else if (strcmp(*argv, "index") == 0) {
NEXT_ARG();
+ if (*index)
+ duparg("index", *argv);
*index = atoi(*argv);
- if (*index < 0)
+ if (*index <= 0)
invarg("Invalid \"index\" value", *argv);
} else if (matches(*argv, "link") == 0) {
NEXT_ARG();
@@ -886,7 +888,7 @@ static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv)
char *name = NULL;
char *link = NULL;
char *type = NULL;
- int index = -1;
+ int index = 0;
int group;
struct link_util *lu = NULL;
struct iplink_req req = {
@@ -922,7 +924,6 @@ static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv)
return -1;
}
- req.i.ifi_index = 0;
addattr32(&req.n, sizeof(req), IFLA_GROUP, group);
if (rtnl_talk(&rth, &req.n, NULL) < 0)
return -2;
@@ -936,7 +937,7 @@ static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv)
"Not enough information: \"dev\" argument is required.\n");
exit(-1);
}
- if (cmd == RTM_NEWLINK && index != -1) {
+ if (cmd == RTM_NEWLINK && index) {
fprintf(stderr,
"index can be used only when creating devices.\n");
exit(-1);
@@ -964,10 +965,7 @@ static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv)
addattr_l(&req.n, sizeof(req), IFLA_LINK, &ifindex, 4);
}
- if (index == -1)
- req.i.ifi_index = 0;
- else
- req.i.ifi_index = index;
+ req.i.ifi_index = index;
}
if (name) {
--
1.7.10.4
^ permalink raw reply related
* [PATCH iproute2 2/3] iplink: Process "alias" parameter correctly
From: Serhey Popovych @ 2017-12-18 18:54 UTC (permalink / raw)
To: netdev
In-Reply-To: <1513623248-7689-1-git-send-email-serhe.popovych@gmail.com>
Do not stop parameters processing after "alias" parameter: it might
not be a last one. Seems copy pasted from "type" parameter code.
Check it's length does not exceed IFALIASZ - 1. Better we warn
than get RTNL error.
Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
---
ip/iplink.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/ip/iplink.c b/ip/iplink.c
index 4f9c169..4c96711 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -770,11 +770,12 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
argc--; argv++;
break;
} else if (matches(*argv, "alias") == 0) {
+ len = strlen(*argv);
+ if (len >= IFALIASZ)
+ invarg("alias too long\n", *argv);
NEXT_ARG();
addattr_l(&req->n, sizeof(*req), IFLA_IFALIAS,
- *argv, strlen(*argv));
- argc--; argv++;
- break;
+ *argv, len);
} else if (strcmp(*argv, "group") == 0) {
NEXT_ARG();
if (*group != -1)
--
1.7.10.4
^ permalink raw reply related
* [PATCH iproute2 3/3] iplink: Kill redundant network device name checks
From: Serhey Popovych @ 2017-12-18 18:54 UTC (permalink / raw)
To: netdev
In-Reply-To: <1513623248-7689-1-git-send-email-serhe.popovych@gmail.com>
Since commit 625df645b703 (Check user supplied interface name lengths)
iplink_parse() validates network device name using check_ifname()
helpers.
Remove redundant "name" length checks from iplink_parse() callers.
Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
---
ip/iplink_vxcan.c | 8 +++-----
ip/link_veth.c | 8 +++-----
2 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/ip/iplink_vxcan.c b/ip/iplink_vxcan.c
index 680f640..c13224c 100644
--- a/ip/iplink_vxcan.c
+++ b/ip/iplink_vxcan.c
@@ -38,7 +38,7 @@ static int vxcan_parse_opt(struct link_util *lu, int argc, char **argv,
char *link = NULL;
char *type = NULL;
int index = 0;
- int err, len;
+ int err;
struct rtattr *data;
int group;
struct ifinfomsg *ifm, *peer_ifm;
@@ -66,10 +66,8 @@ static int vxcan_parse_opt(struct link_util *lu, int argc, char **argv,
return err;
if (name) {
- len = strlen(name) + 1;
- if (len > IFNAMSIZ)
- invarg("\"name\" too long\n", *argv);
- addattr_l(hdr, 1024, IFLA_IFNAME, name, len);
+ addattr_l(hdr, 1024,
+ IFLA_IFNAME, name, strlen(name) + 1);
}
peer_ifm = RTA_DATA(data);
diff --git a/ip/link_veth.c b/ip/link_veth.c
index a368827..fcfd1ef 100644
--- a/ip/link_veth.c
+++ b/ip/link_veth.c
@@ -36,7 +36,7 @@ static int veth_parse_opt(struct link_util *lu, int argc, char **argv,
char *link = NULL;
char *type = NULL;
int index = 0;
- int err, len;
+ int err;
struct rtattr *data;
int group;
struct ifinfomsg *ifm, *peer_ifm;
@@ -64,10 +64,8 @@ static int veth_parse_opt(struct link_util *lu, int argc, char **argv,
return err;
if (name) {
- len = strlen(name) + 1;
- if (len > IFNAMSIZ)
- invarg("\"name\" too long\n", *argv);
- addattr_l(hdr, 1024, IFLA_IFNAME, name, len);
+ addattr_l(hdr, 1024,
+ IFLA_IFNAME, name, strlen(name) + 1);
}
peer_ifm = RTA_DATA(data);
--
1.7.10.4
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox