From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBA46C433EF for ; Fri, 10 Sep 2021 15:00:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9C807611C9 for ; Fri, 10 Sep 2021 15:00:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233907AbhIJPBg (ORCPT ); Fri, 10 Sep 2021 11:01:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233539AbhIJPBf (ORCPT ); Fri, 10 Sep 2021 11:01:35 -0400 Received: from mail-oi1-x234.google.com (mail-oi1-x234.google.com [IPv6:2607:f8b0:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B17CC061574; Fri, 10 Sep 2021 08:00:24 -0700 (PDT) Received: by mail-oi1-x234.google.com with SMTP id y128so3280106oie.4; Fri, 10 Sep 2021 08:00:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=wQtNDxK+stHmlXk66BKubuUVLuPTzjYg0fIt3ivIQek=; b=SYDaDPYgbgJN3VcKQZKoEAgtrCd84+T7uR+OJyE6WcjV+VguQxkSsdXPtKNkx4nQha JNFYscRaBlTDzffUmBCUUppIVYfajHkSlWSWzyXpqmC767U+6R/9A5ogSRbVsK3OO0o/ qEwlnHPEfZQ5+N5YI8TEvgWpvCS2PxWqTFn46pLYj6WYNl3lzchHoT4kW/XnVr9uoi5W 77DfL0xS9jrlYpgFgMQnGxYqF+OhX5t6BXuvAbdbt2OHhvsyFAeLitmz2eEJGoMrdBcM DUyHiJtGWQ60NQ+8t+eSTrG1/H8I5wB/kjfR46LhMG04SBECU40Df7WWLAqHlzOwCIpk TyTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=wQtNDxK+stHmlXk66BKubuUVLuPTzjYg0fIt3ivIQek=; b=nXHWRAjSHgrTI5XDLZOwHdMZu7PqjIyMezvJrTf8Gd3lyROkDy9r3X5Jt1dUDxOga9 e/nXteHP+ie1eR0YoWaSy3YPlnyQAwQ3xX6tHCqAcouW9z6wfGsjBOpolk3w3Vdp0D2H IygWQtk/HIzkHcfJv5ocBxVw/tYHUb0NRDXySbcEucmXwHYrPH+2IcXn/mnGPjk68V7j lzJt5EWZ7B5x2orvTjF/113q35UNwD7a38g5aYhalgGRS0vic+ONp+SrBsecIt1yivIv IfGeL6Wk3jGXq/Cvw+7S14yvjwSZfVSGwQiU2DQn6lnSrx03HzqdWHJg7TgDSG45lqUE zHUA== X-Gm-Message-State: AOAM530xIrAwVk2LLR9zuDIBpmty+Omz3ZeKtJzOBpDud6RNDRUIVO68 QpzqFes3stV+T+SxTf8qkX8= X-Google-Smtp-Source: ABdhPJzdUeZHCJK7gVOaL66L4g1Zgwg1Z0bGxP/5YNQqApki9OrQhrZPKoyKGL3damp5l3xmW1pi4g== X-Received: by 2002:aca:5f04:: with SMTP id t4mr4493370oib.53.1631286023877; Fri, 10 Sep 2021 08:00:23 -0700 (PDT) Received: from ian.penurio.us ([47.184.51.90]) by smtp.gmail.com with ESMTPSA id s8sm1247577otd.76.2021.09.10.08.00.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Sep 2021 08:00:23 -0700 (PDT) Subject: Re: [PATCH v2 04/15] block: Add block device LED trigger integrations To: =?UTF-8?Q?Marek_Beh=c3=ban?= Cc: axboe@kernel.dk, pavel@ucw.cz, linux-leds@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org References: <20210909222513.2184795-1-arequipeno@gmail.com> <20210909222513.2184795-5-arequipeno@gmail.com> <20210910032319.71b843d7@thinkpad> From: Ian Pilcher Message-ID: <4b40f4fc-4baf-c75f-e61f-310fe6d15e0c@gmail.com> Date: Fri, 10 Sep 2021 10:00:23 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210910032319.71b843d7@thinkpad> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org On 9/9/21 8:23 PM, Marek BehĂșn wrote: > On Thu, 9 Sep 2021 17:25:02 -0500 > Ian Pilcher wrote: >> Call ledtrig_blkdev_disk_init() from device_add_disk() to ensure that >> ledtrig is initialized to NULL, in case a driver allocates the structure >> itself and doesn't use kzalloc() > > No, this is not needed. If someone does not use kzalloc(), they should > use it. No need to fix other code here. Yeah. I'm honestly not sure if this is necessary or not, as I don't know if there are any drivers that actually have this problem. I decided to include this for now, because an uninitialized pointer can cause memory corruption, etc., when the disk cleanup function follows a garbage pointer. This recent commit seems to indicate that until recently drivers were responsible for doing gendisk allocation. > commit f525464a8000f092c20b00eead3eaa9d849c599e > Author: Christoph Hellwig > Date: Fri May 21 07:50:55 2021 +0200 > > block: add blk_alloc_disk and blk_cleanup_disk APIs > > Add two new APIs to allocate and free a gendisk including the > request_queue for use with BIO based drivers. This is to avoid > boilerplate code in drivers. Were those drivers expected to use kzalloc() or otherwise zero out the entire structure? I really don't know. I think that it makes sense to defer to the block subsystem maintainers on this question. -- ======================================================================== In Soviet Russia, Google searches you! ========================================================================