Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D5B6C433F5 for ; Sun, 12 Dec 2021 22:32:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229890AbhLLWch (ORCPT ); Sun, 12 Dec 2021 17:32:37 -0500 Received: from mail-pj1-f47.google.com ([209.85.216.47]:45804 "EHLO mail-pj1-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229838AbhLLWcg (ORCPT ); Sun, 12 Dec 2021 17:32:36 -0500 Received: by mail-pj1-f47.google.com with SMTP id f18-20020a17090aa79200b001ad9cb23022so11851208pjq.4; Sun, 12 Dec 2021 14:32:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=YLklU4oFNgyfFShNVsJ5OR2Z3x8Eo2vngmE71GDUBdY=; b=DAjLrqrxgWsHDOTrgTVvNoVNTf2gXJUy1T/26ABVenIDU5rpjmW6dVDeluP0YXS7qR Pkj7qSEj8bW2jLODiKFOpWJmKNz4pKJgq/1as+gQo1uJCIhIKOj9xoi1805hqLxv3EZt QonM4jntZ+bd7TLHYkAN+zT1Mi7HIWqiiJyk0VjvSwhGqjg0lvw3fZFbDOKadDPFFutK yNq9RW28eMfRm3tvkpYUOTayml+ofhBSaq0ElH1ZfdEqWb7EjP/pZ0zFWaA5qDm7fOBv vP0rhrJvAqT+bCVGAylMMjTlSZWv9wAmvHyKoNeQzSOw6NU3/KfVjJXk0piotuvmFprP R6DA== X-Gm-Message-State: AOAM531wtQA4miHvkeSRdvZiRjKHscc3ms0J5TztYCICY7TIV0OneKH8 I5Lq6MsnaPulRMEDWFOSmkb4LuYYUeg= X-Google-Smtp-Source: ABdhPJwBdXx9HhcuFHhMCBuNtlvcNvUDDg6ymTawszqasA5PDaE/kixMuN6iWYC5UAT25hfvhfVW2Q== X-Received: by 2002:a17:902:7c8a:b0:143:bb4a:7bb3 with SMTP id y10-20020a1709027c8a00b00143bb4a7bb3mr92411776pll.46.1639348356102; Sun, 12 Dec 2021 14:32:36 -0800 (PST) Received: from ?IPV6:2601:647:4000:d7:feaa:14ff:fe9d:6dbd? ([2601:647:4000:d7:feaa:14ff:fe9d:6dbd]) by smtp.gmail.com with ESMTPSA id k91sm4827964pja.19.2021.12.12.14.32.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 12 Dec 2021 14:32:35 -0800 (PST) Message-ID: <89507f40-257d-9a17-231b-78460c3141a5@acm.org> Date: Sun, 12 Dec 2021 14:32:33 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.2 Subject: Re: [PATCH] scsi: ufs: ufshcd-pltfrm: check the return value of kstrdup() Content-Language: en-US To: xkernel , jejb@linux.ibm.com, martin.petersen@oracle.com Cc: alim.akhtar@samsung.com, avri.altman@wdc.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org References: From: Bart Van Assche In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/11/21 10:14, xkernel wrote: > kstrdup() can return NULL if some internal memory errors happen, so it > is better to check the return value of it. > > Signed-off-by: xkernel Is xkernel the name of a person or the name of a robot? Patches should be signed by a person even if these have been generated by a robot. > + clki->name = kstrdup(name, GFP_KERNEL); > + if (!clki->name) { > + ret = -ENOMEM; > + devm_kfree(dev, clki); > + goto out; > + } Is the devm_kfree() call necessary? Is it useful? Thanks, Bart.