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=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 B4411C11D00 for ; Fri, 21 Feb 2020 03:23:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8C73420716 for ; Fri, 21 Feb 2020 03:23:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729607AbgBUDXA (ORCPT ); Thu, 20 Feb 2020 22:23:00 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:44496 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729280AbgBUDW7 (ORCPT ); Thu, 20 Feb 2020 22:22:59 -0500 Received: by mail-pf1-f194.google.com with SMTP id y5so448901pfb.11 for ; Thu, 20 Feb 2020 19:22:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bPzWNOjv3O7tUoM8pshITUVi9l0rQND6jwW8+Nd1kEc=; b=o+0qD2xCa5Sz6jpeuSZ3CbldWhJJtOaCzodOAuFX8QYGC9dmj3LGstfBglCMBLMqz5 B6gvIoZEc1L/MrArQyt1di573VnBWluRfB/h9lW73qxxQCYFyBvUn8SIwtGBIYET2AwM fM1tp1Ft8csuEcFgxUb8RjLnGARcP7o4ZJNvzMigGY6GVxluz8uP9iTIWCwwN7qh6rdF yDyc3tJYiMpP2fk2UDwbJuMDvYmGboXPjPyIdTkOduvwIleI5hHH9mg8YeKXypUi3rsc VZiOxQfUpfQVxqSaytowtSJckJxJO4kxOpZMwR6Pcl6yDzNcgG+VIDdPuf4uO57UlWfq 1APA== X-Gm-Message-State: APjAAAXMJsPUdVlpmwmPHRJOLuCw8mgXjJvAt9clG64BsHE4rEln8c8x HZL2A4EDC1zGbbpTBb8eNSc= X-Google-Smtp-Source: APXvYqzzdrkz268E15QpFQ53Q78VIutbAgdfpA9XSCz/IvAFk0qbRzAuvksgREsTGgkXzXNNSVV+AA== X-Received: by 2002:a63:487:: with SMTP id 129mr36277268pge.193.1582255379221; Thu, 20 Feb 2020 19:22:59 -0800 (PST) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:e57a:a1b3:1a44:bb8c]) by smtp.gmail.com with ESMTPSA id x197sm1010517pfc.1.2020.02.20.19.22.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Feb 2020 19:22:58 -0800 (PST) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Christoph Hellwig , Ming Lei , Hannes Reinecke , Johannes Thumshirn Subject: [PATCH v3 4/8] null_blk: Suppress an UBSAN complaint triggered when setting 'memory_backed' Date: Thu, 20 Feb 2020 19:22:39 -0800 Message-Id: <20200221032243.9708-5-bvanassche@acm.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200221032243.9708-1-bvanassche@acm.org> References: <20200221032243.9708-1-bvanassche@acm.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Although it is not clear to me why UBSAN complains when 'memory_backed' is set, this patch suppresses the UBSAN complaint that is triggered when setting that configfs attribute. UBSAN: Undefined behaviour in drivers/block/null_blk_main.c:327:1 load of value 16 is not a valid value for type '_Bool' CPU: 2 PID: 8396 Comm: check Not tainted 5.6.0-rc1-dbg+ #14 Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011 Call Trace: dump_stack+0xa5/0xe6 ubsan_epilogue+0x9/0x26 __ubsan_handle_load_invalid_value+0x6d/0x76 nullb_device_memory_backed_store.cold+0x2c/0x38 [null_blk] configfs_write_file+0x1c4/0x250 [configfs] __vfs_write+0x4c/0x90 vfs_write+0x145/0x2c0 ksys_write+0xd7/0x180 __x64_sys_write+0x47/0x50 do_syscall_64+0x6f/0x2f0 entry_SYSCALL_64_after_hwframe+0x49/0xbe Cc: Christoph Hellwig Cc: Ming Lei Cc: Hannes Reinecke Cc: Johannes Thumshirn Signed-off-by: Bart Van Assche --- drivers/block/null_blk_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/null_blk_main.c b/drivers/block/null_blk_main.c index 16510795e377..7cd31d4ef709 100644 --- a/drivers/block/null_blk_main.c +++ b/drivers/block/null_blk_main.c @@ -276,7 +276,7 @@ nullb_device_##NAME##_store(struct config_item *item, const char *page, \ { \ int (*apply_fn)(struct nullb_device *dev, TYPE new_value) = APPLY;\ struct nullb_device *dev = to_nullb_device(item); \ - TYPE uninitialized_var(new_value); \ + TYPE new_value = 0; \ int ret; \ \ ret = nullb_device_##TYPE##_attr_store(&new_value, page, count);\