Received: by 2002:a05:6358:51dd:b0:131:369:b2a3 with SMTP id 29csp1013705rwl; Thu, 10 Aug 2023 05:20:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE6or85NoAgX1vvkx5x9z48wgbD/85OgFPj3s3eAZ2zg3NlrqyDTeb6lEK1p3PcVxgABFL5 X-Received: by 2002:a17:906:208f:b0:965:9602:1f07 with SMTP id 15-20020a170906208f00b0096596021f07mr2069579ejq.39.1691670027075; Thu, 10 Aug 2023 05:20:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691670027; cv=none; d=google.com; s=arc-20160816; b=SSylVFIwtr56oLvDUq4rUg35gBx37LSZ8BHHwQVnj8ScAs3TBRJoWGOXphZhGOSl4+ Ey5plG1qAdyiYGyDkiGmdVRC8E3ucNgNoIg0Zd6Wwh4WqCurQNcaxDFTK6pSSvo76qZx oentIeZhwc/gTaewGAkfxLjjuh34Tq6Je6j/AsnKtD0zelTqcGO7dktt042XpdLINSSS yoJD3d15+5gIS+8rBW8b49krpB1l7arEoyLROhBWyWD/U9BBh4Oe6PuEYN5cCIq1VpFM HbPd9Z7MwJvwf0imGbOvr4CjzQZ0tmpp6nS16o7qAbtlvfPfE4Xbe9T+DMQLxVlI9nsv l92w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=lMY8frrca41Vekt3XIPmeD0Lb8cpCjOB+63wKDM1sk4=; fh=HidsX1Z97OYgEDFXi93RVcsSC75E+mN9UiX0ZRXGhAE=; b=1B642r6SCT/kCSR0/p0HUM+vxV4EmtuIi15eTsVzERqva9ulU31ng0wXcOm6nELbUP wxQPqtVE5q1glhiP3SVfvIcyWPPKzaYY4YQLQHYWLdAmZxoyUK8rntXBX0ffHiAD6NwY 4Evu0Rze/4lnc1DcUIGifuWSnYn87bbS+SpAUhKS04CEwdBXY5w30s1qdx4Jbp44OvIM q5U7s0E6MnaznyGv4GgzlSLahtfPg1dsD1quA25xuG3Fpi59ef7J+YWHzr3JICQKt6ml NpfCltIJ5d7i4eoYmBEV2pcjUOiBiuQ85hu8tHqkSr+1XOZM5MyL8NF46/mDLiJrMh/7 Au7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yuwvwEWs; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p27-20020a170906229b00b009926703c4b9si1390424eja.413.2023.08.10.05.20.00; Thu, 10 Aug 2023 05:20:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yuwvwEWs; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232642AbjHJLsv (ORCPT + 99 others); Thu, 10 Aug 2023 07:48:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230205AbjHJLsu (ORCPT ); Thu, 10 Aug 2023 07:48:50 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0383091 for ; Thu, 10 Aug 2023 04:48:50 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-4fe58faa5cfso1182874e87.3 for ; Thu, 10 Aug 2023 04:48:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691668128; x=1692272928; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=lMY8frrca41Vekt3XIPmeD0Lb8cpCjOB+63wKDM1sk4=; b=yuwvwEWssHdcYJQa4HinMo7yhgk3OtI280P/MzEtYaRX9hELEOoyJj8zQkrN4PmSLh SiEQIrwGM/cUlp2BHZSAff/8BWu9i4UFfIB8kBea+Dh1GTsSjEDPfBqYnx0GuGt2vkEV EArkKUnhnOluC1F60TzIyeWi6c9+c/zn36PI0ssVaGzdF14uCbLlwbWTvXujWlTU08VV ysLSmSNteK+l0yFq49mlkqhJ6Lng0BvLL7FuXdrxdTqpIIHNTjvoaeVSf71o2dtrJYPm 1yyCxDmKK67mKgLYh1yhueSJ1aRgkgHANLuK1l/uCEUoUz2JKsGohgb6L51CVCYN5hX1 EdRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691668128; x=1692272928; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=lMY8frrca41Vekt3XIPmeD0Lb8cpCjOB+63wKDM1sk4=; b=bgbdTQrslBofbWm9m0g/qu0yK7S+OQ/uw3jatEsAK5ysC2AZjHEqkgDUf4xijULUj1 03fV7uy7QjIq0+xB62/G7zRRgAoZnYPPFjWleLpX9rkKwgHBdHZgeqSZesiNX1J6oCpt 6v2e9Er1/mj8elfowrtCjkOGALGJ7q3pI14+U12zOSbzYBdZMnO31AVpuZoDTAQOkiVY TJTwOvJgWrvFlCY8vpx6pp6JW3VcTZfXUw2gL/Pj0TY/Ln9wVf0u9fp4zT+lGYIa1r4d oHHY58RSQz807MO680nc00wQryFc0s/BgUo5fun9sS5kt3rWFXtXgwcaC3HCsl9gJ9Dl i5zA== X-Gm-Message-State: AOJu0YxqrxWEGZRoVt5h7uk1xsx1QiJrlfb7LhbddL9pQj/rIAi6nVie kPSredCRYO0tv+z11OJho7YBL1/LZ2FmTretdOU= X-Received: by 2002:a05:6512:2141:b0:4fa:6d62:9219 with SMTP id s1-20020a056512214100b004fa6d629219mr1370006lfr.62.1691668128183; Thu, 10 Aug 2023 04:48:48 -0700 (PDT) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id y10-20020a1c4b0a000000b003fe2f3a89d4sm1925342wma.7.2023.08.10.04.48.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Aug 2023 04:48:47 -0700 (PDT) Date: Thu, 10 Aug 2023 14:48:45 +0300 From: Dan Carpenter To: Zhang Yi Cc: linux-ext4@vger.kernel.org Subject: Re: [bug report] ext4: convert symlink external data block mapping to bdev Message-ID: <0ff22f40-3eee-44ed-970d-8ee6af7979e4@kadam.mountain> References: <797feb23-f8c8-4ce7-b25c-b4f591be1387@moroto.mountain> <7f69ac7e-bfad-ec37-f48b-0633583838d5@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7f69ac7e-bfad-ec37-f48b-0633583838d5@huawei.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Thu, Aug 10, 2023 at 07:25:02PM +0800, Zhang Yi wrote: > On 2023/8/10 18:31, Dan Carpenter wrote: > > Hello Zhang Yi, > > > > The patch 6493792d3299: "ext4: convert symlink external data block > > mapping to bdev" from Apr 24, 2022 (linux-next), leads to the > > following Smatch static checker warning: > > > > fs/ext4/namei.c:3353 ext4_init_symlink_block() > > error: potential NULL/IS_ERR bug 'bh' > > > > fs/ext4/namei.c > > 3337 static int ext4_init_symlink_block(handle_t *handle, struct inode *inode, > > 3338 struct fscrypt_str *disk_link) > > 3339 { > > 3340 struct buffer_head *bh; > > 3341 char *kaddr; > > 3342 int err = 0; > > 3343 > > 3344 bh = ext4_bread(handle, inode, 0, EXT4_GET_BLOCKS_CREATE); > > 3345 if (IS_ERR(bh)) > > 3346 return PTR_ERR(bh); > > > >>From reading the code, it looks like ext4_bread() can return both error > > pointers and NULL. (Second return statement). > > Hello, Dan, > > After checking the code, we have passed in EXT4_GET_BLOCKS_CREATE to > ext4_bread(), the return value must be an error code or a valid > buffer_head, it's impossible to return NULL. So I think the warning > is a false positive. > Yep. You're right. Thanks for taking a look at this. Eventually, I will get around to tracking bits set across function boundaries and that should silence this warning. regards, dan carpenter