Received: by 10.213.65.68 with SMTP id h4csp59196imn; Fri, 6 Apr 2018 15:37:49 -0700 (PDT) X-Google-Smtp-Source: AIpwx4876M89qNx5onMwlpSOQVRmPcIqZVml9jWeN+vS2qpYx0XIcne4FC8QrY1ADOUCzJ9XPIeY X-Received: by 10.99.107.65 with SMTP id g62mr8826138pgc.180.1523054269884; Fri, 06 Apr 2018 15:37:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523054269; cv=none; d=google.com; s=arc-20160816; b=AN1t9iC5Gg83S05nFt8XYiZzVBivPsbR21wybvCFisGpjMm7ACPMOtYp6QMFBbMf36 v5nza8a5wXlOGYHZIDg6ythTF3B67/nvmXUUziSpIw2Z+Z3f3r7QhV6qGIFwUcXvv3YG 4ezq+4R135VePfg4cLOKA1lk1R+toQ/WGmr5L+07l63Irppv2F0rirXA1YtTou4D+Pf0 njS3dBlDUm4gS3bRR9yU+MYK8n5Uusut0nB3rLcO9jQqoi68S6W/hB6bdASQ8Uj/LMa7 rfo6jZt18+jFyg6qBL6uaSuYhfdY6CmKpmYR3iS9WIoKCMCMjVTOnYg6HXk6pDtJzUsL P5IQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=f3OagatCuiOs2SyJ+TYoYUH9oTj9lhTKnq83q/MRmnE=; b=gfZR02KMI5kuVI979ub0hkFaNzXK2ouTSxMh41ES941KS5e/epHfa5SxG5+WxHWQ2M LN6/0ZpEUGNA7gr1KFg/cWxH7Cl4qCZHpjQ7mVxazpKdHqgQL6I/3BFbrUi5OWK6Vg1U XTBZDNz8ViJ5K4dvrcGL7Hms7EIl3OrrSOnCSbLk6/pp1uic4IY25Go+ZQPqgPKjTRdL vUfcFMHSx/Z0kYk3GiBwPgSaU3Oz1UAzHaw/coegAaArOsRxZlg6A+zbyzB9farf/Vex cTdoYpmzwFrtDfsJQiJD9K6gD0bt5ES9d6ML9OG3TJdAiXUoxr3DdgTL2riOdJy9KRAW ncfA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r4si7677061pgs.685.2018.04.06.15.37.10; Fri, 06 Apr 2018 15:37:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752291AbeDFWeZ (ORCPT + 99 others); Fri, 6 Apr 2018 18:34:25 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:60480 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751679AbeDFWeY (ORCPT ); Fri, 6 Apr 2018 18:34:24 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7204C8185330; Fri, 6 Apr 2018 22:34:23 +0000 (UTC) Received: from treble (ovpn-120-110.rdu2.redhat.com [10.10.120.110]) by smtp.corp.redhat.com (Postfix) with SMTP id 6758710F1BF6; Fri, 6 Apr 2018 22:34:20 +0000 (UTC) Date: Fri, 6 Apr 2018 17:34:20 -0500 From: Josh Poimboeuf To: Petr Mladek Cc: Jiri Kosina , Miroslav Benes , Joe Lawrence , Jessica Yu , Nicolai Stange , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/2] livepatch: Initialize shadow variables safely by a custom callback Message-ID: <20180406223420.icjwcq7vy24tvecu@treble> References: <20180405122315.29065-1-pmladek@suse.com> <20180405122315.29065-2-pmladek@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180405122315.29065-2-pmladek@suse.com> User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 06 Apr 2018 22:34:23 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 06 Apr 2018 22:34:23 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jpoimboe@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 05, 2018 at 02:23:14PM +0200, Petr Mladek wrote: > @@ -150,6 +149,23 @@ static void *__klp_shadow_get_or_alloc(void *obj, unsigned long id, void *data, > goto exists; > } > > + new_shadow->obj = obj; > + new_shadow->id = id; > + > + if (ctor) { > + int err; > + > + err = ctor(obj, new_shadow->data, ctor_data); > + if (err) { > + spin_unlock_irqrestore(&klp_shadow_lock, flags); > + kfree(new_shadow); > + WARN(1, > + "Failed to construct shadow variable <%p, %lx>\n", > + obj, id); > + return NULL; > + } > + } > + I'm not sure why a constructor would return an error, though I guess it doesn't hurt to allow it. The WARN seems excessive though, IMO. The constructor itself can warn (or printk or whatever else) if it thinks its warranted. Also I think the 'err' variable isn't really needed. -- Josh