Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753308AbbKDHEs (ORCPT ); Wed, 4 Nov 2015 02:04:48 -0500 Received: from mail-io0-f178.google.com ([209.85.223.178]:34268 "EHLO mail-io0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751215AbbKDHEq (ORCPT ); Wed, 4 Nov 2015 02:04:46 -0500 MIME-Version: 1.0 In-Reply-To: <1446620204-4228-1-git-send-email-zlim.lnx@gmail.com> References: <1446620204-4228-1-git-send-email-zlim.lnx@gmail.com> From: Xi Wang Date: Tue, 3 Nov 2015 23:04:05 -0800 Message-ID: Subject: Re: [PATCH] arm64: bpf: fix div-by-zero case To: Zi Shen Lim Cc: Catalin Marinas , Alexei Starovoitov , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1130 Lines: 27 On Tue, Nov 3, 2015 at 10:56 PM, Zi Shen Lim wrote: > case BPF_ALU | BPF_DIV | BPF_X: > case BPF_ALU64 | BPF_DIV | BPF_X: > + { > + const u8 r0 = bpf2a64[BPF_REG_0]; > + > + /* if (src == 0) return 0 */ > + jmp_offset = 3; /* skip ahead to else path */ > + check_imm19(jmp_offset); > + emit(A64_CBNZ(is64, src, jmp_offset), ctx); > + emit(A64_MOVZ(1, r0, 0, 0), ctx); > + jmp_offset = epilogue_offset(ctx); > + check_imm26(jmp_offset); > + emit(A64_B(jmp_offset), ctx); > + /* else */ > emit(A64_UDIV(is64, dst, dst, src), ctx); > break; > + } > case BPF_ALU | BPF_MOD | BPF_X: > case BPF_ALU64 | BPF_MOD | BPF_X: BPF_MOD might need the same fix. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/