Return-Path: <SRS0=qc1w=LZ=kvack.org=owner-linux-mm@kernel.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_RED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4007CC11F66 for <linux-mm@archiver.kernel.org>; Thu, 1 Jul 2021 01:56:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 050C461420 for <linux-mm@archiver.kernel.org>; Thu, 1 Jul 2021 01:56:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 050C461420 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7E7718D0272; Wed, 30 Jun 2021 21:56:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7BFB38D024F; Wed, 30 Jun 2021 21:56:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6AD838D0272; Wed, 30 Jun 2021 21:56:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0132.hostedemail.com [216.40.44.132]) by kanga.kvack.org (Postfix) with ESMTP id 405288D024F for <linux-mm@kvack.org>; Wed, 30 Jun 2021 21:56:03 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 12036250D9 for <linux-mm@kvack.org>; Thu, 1 Jul 2021 01:56:03 +0000 (UTC) X-FDA: 78312353406.30.345C12E Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf29.hostedemail.com (Postfix) with ESMTP id CAE319000328 for <linux-mm@kvack.org>; Thu, 1 Jul 2021 01:56:02 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id C81BB61418; Thu, 1 Jul 2021 01:56:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1625104562; bh=qHGXSWtOk3VLrb2L/UpN8WPAMGnTXo4Y8XT5q4kDFYU=; h=Date:From:To:Subject:In-Reply-To:From; b=EQf4cXfm/QT+FypRh+rCXDv5s+/sEMGyb8QFmUQ3hnwCi/YRQ6DucZicXvtalth2G aFsXwj/ivcX4FCI9TN1btswIyWSqfWG61WklkWz0eDQ8zElwHgVBlLku+LZxXwYLI2 t/hMUK2hcjeluS/fP04vitUfdJ5OyezpgR8LOGSQ= Date: Wed, 30 Jun 2021 18:56:01 -0700 From: Andrew Morton <akpm@linux-foundation.org> To: adobriyan@gmail.com, akpm@linux-foundation.org, linux-mm@kvack.org, mm-commits@vger.kernel.org, torvalds@linux-foundation.org Subject: [patch 167/192] lib: memscan() fixlet Message-ID: <20210701015601.Iv6tEUqqh%akpm@linux-foundation.org> In-Reply-To: <20210630184624.9ca1937310b0dd5ce66b30e7@linux-foundation.org> User-Agent: s-nail v14.8.16 Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=EQf4cXfm; dmarc=none; spf=pass (imf29.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Stat-Signature: apbxrdqet97mdskzgc59ymbs59pnsf7e X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: CAE319000328 X-HE-Tag: 1625104562-600497 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org>
From: Alexey Dobriyan <adobriyan@gmail.com> Subject: lib: memscan() fixlet Generic version doesn't trucate second argument to char. Older brother memchr() does as do s390, sparc and i386 assembly versions. Fortunately, no code passes c >= 256. Link: https://lkml.kernel.org/r/YLv4cCf0t5UPdyK+@localhost.localdomain Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> --- lib/string.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
--- a/lib/string.c~lib-memscan-fixlet +++ a/lib/string.c @@ -977,7 +977,7 @@ void *memscan(void *addr, int c, size_t unsigned char *p = addr; while (size) { - if (*p == c) + if (*p == (unsigned char)c) return (void *)p; p++; size--;