Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4660266ybp; Mon, 14 Oct 2019 08:05:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqwZBWsKlOuW28RMNTXuhQwDUol+936r5rJ/u+Y5AtJQ8WzP9Vi/Y8PpQ7/TCixOep41Fqaa X-Received: by 2002:a17:906:1e55:: with SMTP id i21mr29761777ejj.47.1571065558126; Mon, 14 Oct 2019 08:05:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571065558; cv=none; d=google.com; s=arc-20160816; b=m3RKkNZd1xRaady8oGC3xnb7KrcWMBeJTSc7HAPUkynfYiVHWTYGPOTvfWIU00iE5i Dy0Wf+GQ1+/QBIizO9IgZEddE5fa+h+yPT1B31Kc3EOQ3cgXbpjj/KH3Z8hJHdeWQE/z LEeSYgLbJ5WVV5TVm2DZMUgUJEcxHInKdhXmaCrUhKhV1f/d6kyIhmrOHQxWTVXJlB6w vR3B33bPp73zVm7ninQBWGNokbt3xyGd7+rabJx9VcnD8QR9k3ij2tgA2K7XSc2Phoau KWY98E+jY1pQwD4oWe3He4W4QGehScFNOn3/YZ4gWSDjfoY+OlufKHTtNTeQEBSm4uJg 0c7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=5I0CZjdT/2pnYNFsgHQmuSO9JIMdOamZSLZFBh5OmRw=; b=02hT2CFWBNa5s0YzYDxNNpBrXkWAr+QLgK4H7MWw+16WRAMJSLmQIvSfgVJK6YE7qp j0p7g4L3rOaFMEx6LPBLcxBLHyTSzwDTFRGtwPPUGh5XsS5AcL72jMZRN8Q02aERdC/g UBzRSZGFzuDpuVCGhi3Sk3xzJSi9t4ApW3FwmTLxVAk8MwjEsEgRTsPDl3VEr/ecR7Y3 2Fz9WJl/M+h9xftKNVjUfO/PedLFeejDTb3B12r3IY2Zmoz29FDBefcM/TIg8/JAob0r hA3iDnPvwOZLO91n3tQJsj8yjUoAOYSLQA9L01XyR7XO3FLy/UoB+ptDuL813Zb3Ur+U 9drw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=o99ZYYOV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b26si11677542edy.108.2019.10.14.08.05.31; Mon, 14 Oct 2019 08:05:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=o99ZYYOV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732854AbfJNPFO (ORCPT + 99 others); Mon, 14 Oct 2019 11:05:14 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:49918 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733173AbfJNPFO (ORCPT ); Mon, 14 Oct 2019 11:05:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=5I0CZjdT/2pnYNFsgHQmuSO9JIMdOamZSLZFBh5OmRw=; b=o99ZYYOVu1tmiw7Abm9PzOv3P Va9JabPCGjikdbIolMWRy/pW42cZP+ZM0EGsWhlC9EWWSQ2xEHJEsHRaRCceD3xwlAr8q5LB0dYt7 tA3HjseMFc96j7CH8yS07sFe9QNgMOAxK64wSelG8GjP8iCqmRyfBm1KsFtXUVxfT9SvpvJOAQ168 dML17pRW7isucTPVwXPzK0bvMrmmdNsQ0BDrkbgCvxQfq/bSDneEKjIA4ux9VkKu1ZFSPD/KDY12A buIK92g4TXyyeoSXOMsXfZj1Fz/P89yXBay4uJO5eVqr3rTXlmPtuGPFLga7bI1V3eLvt8xE3of2w 0O6hI4Mrw==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1iK1uE-0007fP-VL; Mon, 14 Oct 2019 15:05:06 +0000 Date: Mon, 14 Oct 2019 08:05:06 -0700 From: Matthew Wilcox To: Walter Wu Cc: Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Matthias Brugger , kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, wsd_upstream@mediatek.com Subject: Re: [PATCH 1/2] kasan: detect negative size in memory operation function Message-ID: <20191014150506.GX32665@bombadil.infradead.org> References: <20191014103632.17930-1-walter-zh.wu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191014103632.17930-1-walter-zh.wu@mediatek.com> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 14, 2019 at 06:36:32PM +0800, Walter Wu wrote: > @@ -110,8 +111,9 @@ void *memset(void *addr, int c, size_t len) > #undef memmove > void *memmove(void *dest, const void *src, size_t len) > { > - check_memory_region((unsigned long)src, len, false, _RET_IP_); > - check_memory_region((unsigned long)dest, len, true, _RET_IP_); > + if (!check_memory_region((unsigned long)src, len, false, _RET_IP_) || > + !check_memory_region((unsigned long)dest, len, true, _RET_IP_)) This indentation is wrong. Should be: + if (!check_memory_region((unsigned long)src, len, false, _RET_IP_) || + !check_memory_region((unsigned long)dest, len, true, _RET_IP_)) (also in one subsequent function)