Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp6005244ybx; Mon, 11 Nov 2019 02:15:27 -0800 (PST) X-Google-Smtp-Source: APXvYqyYc+WvHG6zZlATBTRWXOm5DwabUb60RdSR0DyqU6SyY/YLU0Gj6sHEZFSOa8XJQI9ysjcb X-Received: by 2002:a17:906:4558:: with SMTP id s24mr21657344ejq.38.1573467327256; Mon, 11 Nov 2019 02:15:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573467327; cv=none; d=google.com; s=arc-20160816; b=oztsNx2ptgsASPk3GPGx8+7BbsmXVVQ1KImGzhIW/qbmvJZybUpKu6RDqs5VTtcGmN 2/F2I6z8Bqtg/7Wib8YxxBrBn3TgjQhR9kKVe3P1i4KiYryUL4YQCkvyblHnNYGHYwuy ojnGBrplS5FBrn7vspd0kwDcqzyr+ybT2v7xE3g8D2zFNuoFCjKWiEThaIvZDR/3qe4X JeNQhLOw88s99dm8lvx5i5anmQs1r3RpabcYYx38//hVNuBKdTIqSaH7fingKSjJBQEF +9rAxFgSmYtwX5Lx619hC3OSTqi85YpSsL4Rf5hre8vc71IWfAgkw4giJho6nN9g6Vt9 Es9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=toF+FrGCVhoFJVjUfttIEjB8V6geaXrgJXG1BEMe0Ac=; b=aSAt0n2sZFmAyWP4TznnQbRdFlsewrna4a8sTZYGR3QhP4Zij+SwjRxlkzsqV7INq8 ZIptIXycamaD9cR8Vn4L5GE2OsmcURosvd0snMcgMiygE5qDsEhWqnwzmf3dscBA6wuI go+d6JTT3EzUImxHylfFnq/HZFmUhm00My0e2+CDtURQnaCfdCCtrPVduY1WZJaaCHK+ JYJEdFLUg5HmuLxIwlFurpchDS5a+EF5IYR+2MZwZmlzzxWOVWtuNJeFyD5TchVcJnXC 8lvuOv/gJ+uJGGVmy22etm3J2/tOFtC9Mj5kaOW1kcVmAVOFcLjbcKo5ciBgQ0cfdbc8 sl1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=pTHWaONq; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p29si11658964eda.104.2019.11.11.02.15.03; Mon, 11 Nov 2019 02:15:27 -0800 (PST) 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=pass header.i=@mediatek.com header.s=dk header.b=pTHWaONq; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726959AbfKKKMi (ORCPT + 99 others); Mon, 11 Nov 2019 05:12:38 -0500 Received: from mailgw01.mediatek.com ([210.61.82.183]:7827 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726768AbfKKKMh (ORCPT ); Mon, 11 Nov 2019 05:12:37 -0500 X-UUID: 70df4b08df754a48a14c29be91d7b985-20191111 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:MIME-Version:Content-Type:References:In-Reply-To:Date:CC:To:From:Subject:Message-ID; bh=toF+FrGCVhoFJVjUfttIEjB8V6geaXrgJXG1BEMe0Ac=; b=pTHWaONq7n5hFbK5fjWsuaxJ39Pnv3+J8zLuUiVSHYEI2zHezLjueSX7J4XudA0OiMiyKoJ4Fx0kjEHpEe3HHJTZes7pXT6O1L+Yo8Il+vyy5AuP6CZvfBj9mfxWjqxwW5HBkdkJfhPxII7M9g4g8LB9SsMiRwvSd2dmqwy1nug=; X-UUID: 70df4b08df754a48a14c29be91d7b985-20191111 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 346899562; Mon, 11 Nov 2019 18:12:31 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 11 Nov 2019 18:12:28 +0800 Received: from [172.21.84.99] (172.21.84.99) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Mon, 11 Nov 2019 18:12:27 +0800 Message-ID: <1573467150.20611.57.camel@mtksdccf07> Subject: Re: [PATCH v3 1/2] kasan: detect negative size in memory operation function From: Walter Wu To: Andrey Ryabinin CC: Alexander Potapenko , Dmitry Vyukov , Matthias Brugger , , , , , wsd_upstream Date: Mon, 11 Nov 2019 18:12:30 +0800 In-Reply-To: <757f0296-7fa0-0e5e-8490-3eca52da41ad@virtuozzo.com> References: <20191104020519.27988-1-walter-zh.wu@mediatek.com> <34bf9c08-d2f2-a6c6-1dbe-29b1456d8284@virtuozzo.com> <1573456464.20611.45.camel@mtksdccf07> <757f0296-7fa0-0e5e-8490-3eca52da41ad@virtuozzo.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 MIME-Version: 1.0 X-MTK: N Content-Transfer-Encoding: base64 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org T24gTW9uLCAyMDE5LTExLTExIGF0IDEyOjI5ICswMzAwLCBBbmRyZXkgUnl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