From patchwork Fri Jul 3 15:53:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Rix X-Patchwork-Id: 11642149 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 8AEB913B6 for ; Fri, 3 Jul 2020 15:54:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 51C3B208C7 for ; Fri, 3 Jul 2020 15:54:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="bu/0Va1p" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 51C3B208C7 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 5B2CB8D008C; Fri, 3 Jul 2020 11:54:03 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 563BF8D0074; Fri, 3 Jul 2020 11:54:03 -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 479F58D008C; Fri, 3 Jul 2020 11:54:03 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0228.hostedemail.com [216.40.44.228]) by kanga.kvack.org (Postfix) with ESMTP id 3444A8D0074 for ; Fri, 3 Jul 2020 11:54:03 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id D3F625833 for ; Fri, 3 Jul 2020 15:54:02 +0000 (UTC) X-FDA: 76997210724.04.egg23_2703cbe26e93 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin04.hostedemail.com (Postfix) with ESMTP id AA5918019AAC for ; Fri, 3 Jul 2020 15:54:02 +0000 (UTC) X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,trix@redhat.com,,RULES_HIT:30054:30070,0,RBL:205.139.110.61:@redhat.com:.lbl8.mailshell.net-66.10.201.10 62.18.0.100;04y8t6rpx438hmekmiyikjy861gdyyc15c1hc36r9quiq7m67rac8p1swhd1ibq.mhocxzwjp3mdexyyctix7dknanfj1qua79tm9mnyksmquxj7idou8z1a49shgco.6-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:24,LUA_SUMMARY:none X-HE-Tag: egg23_2703cbe26e93 X-Filterd-Recvd-Size: 4057 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by imf03.hostedemail.com (Postfix) with ESMTP for ; Fri, 3 Jul 2020 15:54:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593791641; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type; bh=4qID0ZJaeTJxhzFANYqylxfwR8yL+lxsbh+RcCg6IxA=; b=bu/0Va1p+AdHiFsKRfN/vfKKyQ4x0WwxsH59PjQ4RZBAvYF//ocUdiR7TTptrAzeSgLVEW zFBGUvZDyVyJPPEzPxu7USeLbMenElyP8zSwSILy2Xp5gkON98yusQ+X7rAjDGDhv0CVrN 6q1cn/fS4ufi4yhSn5LnRBMOKrGGPts= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-200-fH8xtY62MoKwmGB-ajT_cA-1; Fri, 03 Jul 2020 11:54:00 -0400 X-MC-Unique: fH8xtY62MoKwmGB-ajT_cA-1 Received: by mail-qk1-f199.google.com with SMTP id o26so21906131qko.7 for ; Fri, 03 Jul 2020 08:54:00 -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=4qID0ZJaeTJxhzFANYqylxfwR8yL+lxsbh+RcCg6IxA=; b=STstIRGVv7NjRz9ZGrCOZMRkutzGB0MdLREpHSbCQqBEazhYTaX7yLjuoVuM3ATo4h uVmzPHbjJ8st+0Lj+bRaPLxQrIbp1eoNvSnRWUMwzZelMyvfEnZUq2Y3vp7xLEd6u0ME N86Bi/7tRDyouerlVnaYqmDeL2a1kEIAxSgAb0ox2F85WXtDdt/13dmkbwTbMOGS0XJ1 K9rnhc3r5I73K1SFQFjHO1HgcMuZ57egCPdRxT2LA4R2wavYz6btEL8otYNv4lO5yPw7 hhJQRZZLh1gdYIZGua0aIgTiTKAyYJ3sfqQbW7sTdvs+gIv2iQqO0nE6Y+iJS+jHXR4p FoVw== X-Gm-Message-State: AOAM5316AbUGsgZGrn/mbCTmvbvgft+zkJy/mt713FZ9rsx/p9JxtwNf lkBe4c4N4BpEQTpEMlWAMDMegh7IbXCOutf/pkJQI+87mg/JS4wFhs6DY868HKvKV/WK3KIwmqI FjjUf2BuGHGc= X-Received: by 2002:a37:a8c7:: with SMTP id r190mr33031730qke.156.1593791639758; Fri, 03 Jul 2020 08:53:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmqMKz6gFD5FSIJ931PXe575jCMsLI6vSuRwnTbWTzh9iHJVIjOidlyvioj0mAqjG9kDRNpw== X-Received: by 2002:a37:a8c7:: with SMTP id r190mr33031721qke.156.1593791639569; Fri, 03 Jul 2020 08:53:59 -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 s8sm11553622qtc.17.2020.07.03.08.53.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jul 2020 08:53:58 -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 v2] mm: initialize return of vm_insert_pages Date: Fri, 3 Jul 2020 08:53:54 -0700 Message-Id: <20200703155354.29132-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: AA5918019AAC X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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 --- v1 change err intializer to -EINVAL mm/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memory.c b/mm/memory.c index 17a3df0f3994..76a00f414777 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 = -EINVAL; for (; idx < pgcount; ++idx) { err = vm_insert_page(vma, addr + (PAGE_SIZE * idx), pages[idx]);