From patchwork Fri Jul 3 14:52:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Rix X-Patchwork-Id: 11641993 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9D9A513B6 for ; Fri, 3 Jul 2020 14:52:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 69C022088E for ; Fri, 3 Jul 2020 14:52:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="h7wdDfDQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 69C022088E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 72AEA8D0068; Fri, 3 Jul 2020 10:52:12 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6DAC58D0067; Fri, 3 Jul 2020 10:52:12 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5CA7E8D0068; Fri, 3 Jul 2020 10:52:12 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0248.hostedemail.com [216.40.44.248]) by kanga.kvack.org (Postfix) with ESMTP id 43A698D0067 for ; Fri, 3 Jul 2020 10:52:12 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id ABBC7180AD802 for ; Fri, 3 Jul 2020 14:52:11 +0000 (UTC) X-FDA: 76997054862.04.sense28_4a13a7426e92 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin04.hostedemail.com (Postfix) with ESMTP id 83E1B80181B0 for ; Fri, 3 Jul 2020 14:52:11 +0000 (UTC) X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,trix@redhat.com,,RULES_HIT:30054,0,RBL:207.211.31.120:@redhat.com:.lbl8.mailshell.net-66.10.201.10 62.18.0.100;04ygdrezs7n4dksd3r7k6qtkaqo5cyc15c1hc36r6bh3w6q7znac8p1swhd1ibq.mhocxz1d18iw93t6rajwopg374fj1qua79tbru643j6oi1qe8hfxuubzgjofyyr.n-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:ft,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:33,LUA_SUMMARY:none X-HE-Tag: sense28_4a13a7426e92 X-Filterd-Recvd-Size: 4006 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by imf05.hostedemail.com (Postfix) with ESMTP for ; Fri, 3 Jul 2020 14:52:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593787930; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type; bh=QudHBrdzjmVd28xDQGtC/cC/sJDo4qzGo07yY4jix9M=; b=h7wdDfDQCHUe09rRcYlwYilSSVWiigSEFVpfz/7Ad71P8brikQQ1IZGX3z8l31oj5z5Glp QZIZuCUQjzn6UOHFXGr7NKhXK5jmLTzTs77r9shnUYaC4gi6M+gpqBZ5spfK8rsDTE4lqf 7YYdu3LQNx0B1Xz5H9pyHv52fmrkA+Y= Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-205--vbXMvo3ObOwzQd4Wup78A-1; Fri, 03 Jul 2020 10:52:08 -0400 X-MC-Unique: -vbXMvo3ObOwzQd4Wup78A-1 Received: by mail-qt1-f198.google.com with SMTP id y5so21871568qto.10 for ; Fri, 03 Jul 2020 07:52:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=QudHBrdzjmVd28xDQGtC/cC/sJDo4qzGo07yY4jix9M=; b=WOtgTSMXSpRcUtCd/J0+p0lAidL3/L19bOtjS/gX/zbqkR2eJVutkYUP4yKbj4cA/5 DY7j8vSIL3qO2hRaUQYRDoBaUGvvZ4rKC2BtIt1FVXIaqEb7IVR1XI2eBBuujKtfkyW7 TXPUBMZEH1rtvsyqsEDkxDCTxWTpe9EtLfIHA888ajoIPhuGmcQAEPnRphwO7VkrpSHn F68UhUG6j13aF8kqxmeNEaV+StlKghVt+6XOW0TfXkYUh/oRmagu7cyYzwDYKbM+Vl68 11CW6ecNg2PWMEhbRunLdOXkaLrvP0CSMJYHIkCOTzMF4o3uGCQh1cWpAhLn996r6+kD 29UQ== X-Gm-Message-State: AOAM531sUHjD51ZMB7nOCXZL6MmVYqkXSWmHQ0R2R/AFtG4dnAdlcsSX oRNn/y3dg5cTmJgEoxY2DAsyrbJfk5SwXOVt7aIAtr/oP8eM6YuyqbDoJU6ZlKOwIxPQ4lm4QGW ipympVUgwA9A= X-Received: by 2002:ad4:4d04:: with SMTP id l4mr21914258qvl.245.1593787928512; Fri, 03 Jul 2020 07:52:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzoimR8INGoVqP0cPifC80a9/k/bJr13oIdtOMecUm5dqLTiX5Qn1NIk9jciowiDn01prQ7HA== X-Received: by 2002:ad4:4d04:: with SMTP id l4mr21914249qvl.245.1593787928344; Fri, 03 Jul 2020 07:52:08 -0700 (PDT) Received: from trix.remote.csb (075-142-250-213.res.spectrum.com. [75.142.250.213]) by smtp.gmail.com with ESMTPSA id s46sm12708678qts.85.2020.07.03.07.52.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jul 2020 07:52:07 -0700 (PDT) From: trix@redhat.com To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Tom Rix Subject: [PATCH] mm: initialize return of vm_insert_pages Date: Fri, 3 Jul 2020 07:52:02 -0700 Message-Id: <20200703145202.10629-1-trix@redhat.com> X-Mailer: git-send-email 2.18.1 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=trix@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Rspamd-Queue-Id: 83E1B80181B0 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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: From: Tom Rix clang static analysis reports a garbage return In file included from mm/memory.c:84: mm/memory.c:1612:2: warning: Undefined or garbage value returned to caller [core.uninitialized.UndefReturn] return err; ^~~~~~~~~~ The setting of err depends on a loop executing. So initialize err. Signed-off-by: Tom Rix --- mm/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memory.c b/mm/memory.c index 17a3df0f3994..41513275823b 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -1601,7 +1601,7 @@ int vm_insert_pages(struct vm_area_struct *vma, unsigned long addr, return insert_pages(vma, addr, pages, num, vma->vm_page_prot); #else unsigned long idx = 0, pgcount = *num; - int err; + int err = 0; for (; idx < pgcount; ++idx) { err = vm_insert_page(vma, addr + (PAGE_SIZE * idx), pages[idx]);