Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp2097295pxy; Mon, 2 Aug 2021 19:34:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwh4RC07EcMrU09W8uGc7eFbK6hWMcR0dkEMYqAq05BboQmTvJqIFn5C2MJP5szwqu5U0tk X-Received: by 2002:a92:8712:: with SMTP id m18mr238377ild.132.1627958083156; Mon, 02 Aug 2021 19:34:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627958083; cv=none; d=google.com; s=arc-20160816; b=HL+eCoQNmNEVanGgJlNho++3eeEZeGcWAX1fzhYi1B+m+8CWWfnqeDW23P5J0G1gL7 7vN/kkgfnD4pg6i+7N/z+tQUIUF17ckgwYz0DxuWLV0rTBQsTMH61ir/8srmdWURyNnH n/AskVxy0ML/1W+2utNg+Sa8kJFZSXcvwPTh3gbNEk7/if5bRh2nkfIAr0xzK6CKmbAO RweKxcJhZGHqzDtGBhuUTCdEZEq0O7+AfO0Q3uvslsaT8ropLjgQ73f3CIW37RhVFKy2 VCpnVD4uEDUEOSfyWN84QIYRIHwOJPdl9EfIoz53+CpG4iUIlyrBPM6m31VK9vzYcz60 MnIA== 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; bh=dz/OXTTXAbVZeOcGXUSGCKJn6WCdIOvlN4N2vdO8L88=; b=a5PNy9tOYxB2SyDeLr2IS4GUmwRYyGUGXAdi2R+fatBLgiTrtRMSau0PZydMYi8B3c KOrcqvbeUjGIQ2SvDrf2/pjojfySmJ/7mIZ8MJXBgnnqDXm0A39q2LR9ubym7iqWmPOO ZKObES9EoLgP+Owmi2+VSqvgQgmZd+GuYxvzajH5mQ9BZj9rl0cja6b3rOUI+MxhIR1J QY6hMfidwG8aYQiuwXT1lIz+XXNestDDSLbqCJ9iuiiB9m7ImjG2s7/HcgePdLZ3O78M rK6XSKL2GlYNQyu+Be1899NS4dJ/iRh/raZiDWlJQnpM8ZpfNpB8uB2DOkdQohQRhQUu 9P3A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d21si14618777ioh.102.2021.08.02.19.34.20; Mon, 02 Aug 2021 19:34:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233197AbhHCCeL (ORCPT + 99 others); Mon, 2 Aug 2021 22:34:11 -0400 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:46944 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233304AbhHCCeK (ORCPT ); Mon, 2 Aug 2021 22:34:10 -0400 Received: from cwcc.thunk.org (pool-72-74-133-215.bstnma.fios.verizon.net [72.74.133.215]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 1732Xqva018394 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 2 Aug 2021 22:33:54 -0400 Received: by cwcc.thunk.org (Postfix, from userid 15806) id 6D22A15C3DD2; Mon, 2 Aug 2021 22:33:52 -0400 (EDT) Date: Mon, 2 Aug 2021 22:33:52 -0400 From: "Theodore Ts'o" To: wuguanghao Cc: linux-ext4@vger.kernel.org, linfeilong@huawei.com, liuzhiqiang26@huawei.com Subject: Re: [PATCH v3 10/12] hashmap: change return value type of ext2fs_hashmap_add() Message-ID: References: <20210728015648.284588-1-wuguanghao3@huawei.com> <20210728015648.284588-4-wuguanghao3@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210728015648.284588-4-wuguanghao3@huawei.com> Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Wed, Jul 28, 2021 at 09:56:47AM +0800, wuguanghao wrote: > From: Zhiqiang Liu > > In ext2fs_hashmap_add(), new entry is allocated by calling > malloc(). If malloc() return NULL, it will cause a > segmentation fault problem. > > Here, we change return value type of ext2fs_hashmap_add() > from void to int. If allocating new entry fails, we will > return 1, and the callers should also verify the return > value of ext2fs_hashmap_add(). > > Signed-off-by: Zhiqiang Liu > Signed-off-by: Wu Guanghao Thanks, applied. Note: I changed ext2fs_hashmap_add() to return an int instead of an errocode_t. The commit description said it was going to be an int, and the code returns -1 (so I fixed the commit description to reflect -1). Note that errcode_t is not appropriate for non-errno / com_err error codes. So making the function prototype of hashmap_add() to return an int is the correct thing to do. Cheers, - Ted