Path: csiph.com!aioe.org!bofh.it!news.nic.it!robomod From: Emil Velikov Newsgroups: linux.kernel Subject: Re: [PATCH v7 3/3] SMAF: add fake secure module Date: Tue, 17 May 2016 01:20:01 +0200 Message-ID: References: X-Original-To: Benjamin Gaignard Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=2xL7LJGABzRsTTuLpYp1R72d8mtfw3caQp4AVdd1JRo=; b=aUaVizFdPLRYTO317aZ3i33s9N8lkDhrJbwpJazJmNSq55vYAHRnhhzWcjhP1ReTdY veOMUrA/8h/sG3BhhHC0HPAYPcBEtIed/GUi5eCFJu555//rPSDBNUpz1WBNP7YCNmGE YICJQjbFFp3zABIO32qN7JEua2mVAs7SGOh3Gbsf50Tsior/B6e1jA+1XhEnql9I+34j QAbGK/OOT+ULvbv5Wk64aJgKMs8qxRxyFSEPqjIP8Pp3LBk1dT6JNHviuCvPBrV9ywzU pYZToGAL1Vcl0mqhNVK3HJWT8KBkej6twdqQgMcBbDuzREucfqUf4iYbhL1CEobIs77z hy6g== X-Google-Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=2xL7LJGABzRsTTuLpYp1R72d8mtfw3caQp4AVdd1JRo=; b=A0OMw7mwo62pNFtaskEuJcKnK6BV2ldQebqh2J+Bd1Qam9Lec0oBwWmSR4VXfLcJ3Q VY9ooi0DAZB39cvcqKhJwGuP5ZxZD4pg9Ffq4ZaeCux1gXWPrx/IIDOBC5H8BQ9pmrpu 692r/DcUbrX1v9TzwapyDOxkKei6urHvq93XyWfVm+3xBvVLpuUWJWrcnhzn7enq06gp Byhm8PuXfcWVTh3pgNTFw6njZaaYRAwfN/MYkKVxCtqagDf4ghCTwvhWtEyzQ+7XGqoC DVvie54wLtb5OC2nbQRRk2uMTAQ1y//Md4pmOjWxB/0aHiGGOAS7lNL/r5KtJoSus33w +oTA== X-Gm-Message-State: AOPr4FXEf0ww7Af2EZ7d197Dtdxh4dF1CVzTtF3fzja9zpmijVX3eUVR7ERBKLsNqkq7BrIJPS8SkCCexr/+XA== MIME-Version: 1.0 X-Received: by 10.194.174.71 with SMTP id bq7mr15591263wjc.64.1463440224422; Mon, 16 May 2016 16:10:24 -0700 (PDT) Content-Type: text/plain; charset=UTF-8 Sender: robomod@news.nic.it List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Approved: robomod@news.nic.it Lines: 57 Organization: linux.* mail to news gateway X-Original-Cc: linux-media@vger.kernel.org, "Linux-Kernel@Vger. Kernel. Org" , ML dri-devel , zoltan.kuscsik@linaro.org, Sumit Semwal , cc.ma@mediatek.com, pascal.brand@linaro.org, joakim.bech@linaro.org, dan.caprita@windriver.com X-Original-Date: Tue, 17 May 2016 00:10:24 +0100 X-Original-Message-ID: X-Original-References: <1462806459-8124-1-git-send-email-benjamin.gaignard@linaro.org> <1462806459-8124-4-git-send-email-benjamin.gaignard@linaro.org> X-Original-Sender: linux-kernel-owner@vger.kernel.org Xref: csiph.com linux.kernel:1401810 Hi Benjamin, On 9 May 2016 at 16:07, Benjamin Gaignard wrote: > This module is allow testing secure calls of SMAF. > "Add fake secure module" does sound like something not (m)any people want to hear ;-) Have you considered calling it 'dummy', 'test' or similar ? > --- /dev/null > +++ b/drivers/smaf/smaf-fakesecure.c > @@ -0,0 +1,85 @@ > +/* > + * smaf-fakesecure.c > + * > + * Copyright (C) Linaro SA 2015 > + * Author: Benjamin Gaignard for Linaro. > + * License terms: GNU General Public License (GPL), version 2 > + */ > +#include > +#include > +#include > + > +#define MAGIC 0xDEADBEEF > + > +struct fake_private { > + int magic; > +}; > + > +static void *smaf_fakesecure_create(void) > +{ > + struct fake_private *priv; > + > + priv = kzalloc(sizeof(*priv), GFP_KERNEL); Missing ENOMEM handling ? > + priv->magic = MAGIC; > + > + return priv; > +} > + > +static int smaf_fakesecure_destroy(void *ctx) > +{ > + struct fake_private *priv = (struct fake_private *)ctx; You might want to flesh this cast into a (inline) helper and use it throughout ? ... and that is all. Hope these were useful, or at the very least not utterly wrong, suggestions :-) Regards, Emil P.S. From a quick look userspace has some subtle bugs/odd practises. Let me know if you're interested in my input.