Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp2684707pxy; Sun, 25 Apr 2021 01:01:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzy6Ys2YEp2YWoMbU4B1TRkUKIwaxaCIpHZkcEuFOiYQ0a80mjC3dYGM4vYUXEjK7M0kPe7 X-Received: by 2002:a17:90b:368b:: with SMTP id mj11mr13943971pjb.217.1619337678569; Sun, 25 Apr 2021 01:01:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619337678; cv=none; d=google.com; s=arc-20160816; b=Tczl1/kZ8gbsA75QpmNRUKl8tD6y81MDh6/oE+14kFPIqoI32phhv5Xb4O3ilpczYd Q1LktA/06RRtTcatB8nW82/juQnW1lln8/31lfyDrTK1Gm2+CT+aTqUOt8CT+iqBD6YI ScHqoZVsDpUKxIaMcpLX+AfAaVGWLNxpB9/5NSApsFp4m0sB3SjwqjEZBU1v6w7Cbzce 4ZB8yyk4Pibhj3TScPQKb1VWBqFw4f/+S1SX+tTOJyoqGdE1UCbK5G23QxKz7MJxYP+6 Vbf2wsDw3WV4liz6ODsiidV7BnVSL+qOrHiCkhWLZZ1nA+G0XDY6hwR7LqvJdi7npWh6 ayuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=wO5bRVcyt6yZoz6NLAkY2DduZypjGZo15T9PtBh9i8s=; b=RAltMUhtXpQs6Cq79+oiISLQMzIOVQUUjxQjR1W58reUpgt52BmQEcwe0FGzl+RF9V gfb9l04InjBAyomjN8EPo7kAZ2eHEI7VHfZm6IAylU66jBG90UjE6LcYHVMBm/jz3qAK N3v9FI6mCpv8dMW1Mpq0zrZxsTdKlzNrpCu4HRmfA1YTko0XqRjwei2UmVScEmYU/6cF 7rYBdA5CwZrylZHHvPouMUPIdFlOLJtg23wHBzTSVLuYsdNBvTX99w4EeWXY2923mYR9 fOl4B1fPAdxyIHNLH4E4iMrrtgr46s3ajYn96MjwAX514Lp7JCvovZKefCxNHk7OfpQ+ O8Dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cAhp0WT7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f12si15951010pfa.326.2021.04.25.01.01.05; Sun, 25 Apr 2021 01:01:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cAhp0WT7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229527AbhDYIBP (ORCPT + 99 others); Sun, 25 Apr 2021 04:01:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229504AbhDYIBO (ORCPT ); Sun, 25 Apr 2021 04:01:14 -0400 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E333C061574 for ; Sun, 25 Apr 2021 01:00:33 -0700 (PDT) Received: by mail-lj1-x235.google.com with SMTP id a5so23449934ljk.0 for ; Sun, 25 Apr 2021 01:00:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wO5bRVcyt6yZoz6NLAkY2DduZypjGZo15T9PtBh9i8s=; b=cAhp0WT7d7J+4pFI+vBcQTlxZcaTldrIsJ9XYCVKupmFC/fCcLgMENRzugC2IJ5T9S Dvr1N01QlHGOJhZNBnUDOh2KFtF7GNbF7pWPRvHf2DiC0F2KwLSNtVKg51476nN/nJ02 SbE94R5eoVLifGKELbNUL9qJJYpxMTXduETvpKWiYQfatWc1B5gYzft1VlibnMPvPt3x 1DIHhgX3Vp02gEuYGb7Dv3QA3MMu4KuJYqqCdF3oDt0tlbGkeUqPEcb9n8Wjq1ltOOa2 otWY1kBsgvzUY9/UoKQDuDZFPOcW6ePKBg2qzefc1olk/yAgfa16khJL0m2coJhh/zGP fJjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wO5bRVcyt6yZoz6NLAkY2DduZypjGZo15T9PtBh9i8s=; b=txt1afsDLEdrsk+AASUffcYh7SucCm4H2hZbMWMB47yaYZRUqb/iLotyJNfYFa3sQz 0Sr4g6UWjP8M5fFkUtQltRFqoZwtuKI3n1qpuseRF+12c7XEtz49iNNikZl+0Mng/7vU vBEpn6L3rphmd4xSOD0cyf75lgLwS7E7qCTGQyMV42cXp6OEnl9PNxRP4N6opEx1rRRc RkAq9NKp1GOES4Lv46FDZm8RNMd3qmSRNYE6Pu/9vxTGInXiMDs9DKFe+ZYvRIoZY+p4 WcT8AY8HiXhA5WQtSITgkk4GUFZP4fIVy64xZoEyc1w/rKfRSCvtsaTTIzi9AlOHJktN Q1qQ== X-Gm-Message-State: AOAM530q9yz0k0mDQyIomH02XXNM4AI3jYDojYQcuUHuQTZsiV/2PYng 9k73gcERm20nYWMS9NypDvcTTb9Jy1cQDaopOSM= X-Received: by 2002:a2e:8256:: with SMTP id j22mr9019755ljh.284.1619337631808; Sun, 25 Apr 2021 01:00:31 -0700 (PDT) MIME-Version: 1.0 References: <20210425074450.6902-1-dwaipayanray1@gmail.com> In-Reply-To: <20210425074450.6902-1-dwaipayanray1@gmail.com> From: Dwaipayan Ray Date: Sun, 25 Apr 2021 13:30:28 +0530 Message-ID: Subject: Re: [PATCH v2] checkpatch: fix uninitialized return value in raw_line subroutine To: Joe Perches Cc: linux-kernel , Lukas Bulwahn Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Apr 25, 2021 at 1:14 PM Dwaipayan Ray wrote: > > In case the second argument to raw_line subroutine is 0, > $line remains uninitialized and is returned back to the caller. > If the caller then tries to perform string concatenation with > that value, checkpatch throws an error: > > Use of uninitialized value in concatenation (.) or string at > ./scripts/checkpatch.pl line 1960. > > Fix it by providing an empty string as the initial value > for $line. > Please ignore this patch. There was a different problem which caused the error. The following line triggers the errors: DEVICE_ATTR(foo, 0777, foo_show, foo_store) (notice the missing semicolon) Perl throws the following errors when checkpatch is run on a file containing that line: Use of uninitialized value in concatenation (.) or string at ./scripts/checkpatch.pl line 1960. Use of uninitialized value in concatenation (.) or string at ./scripts/checkpatch.pl line 1960. Use of uninitialized value in concatenation (.) or string at ./scripts/checkpatch.pl line 1960. Use of uninitialized value in concatenation (.) or string at ./scripts/checkpatch.pl line 1960. Use of uninitialized value in concatenation (.) or string at ./scripts/checkpatch.pl line 1960. Use of uninitialized value in concatenation (.) or string at ./scripts/checkpatch.pl line 1960. Use of uninitialized value in concatenation (.) or string at ./scripts/checkpatch.pl line 1960. Use of uninitialized value in concatenation (.) or string at ./scripts/checkpatch.pl line 1960. Use of uninitialized value in concatenation (.) or string at ./scripts/checkpatch.pl line 1960. Use of uninitialized value in concatenation (.) or string at ./scripts/checkpatch.pl line 1960. Setting $line to "" in raw_line fixed it. Probably -1 is being sent as the second argument to raw_line which results in the uninitialized thing. Thanks, Dwaipayan