Received: by 10.223.164.200 with SMTP id h8csp904373wrb; Mon, 6 Nov 2017 00:35:10 -0800 (PST) X-Google-Smtp-Source: ABhQp+QdycfFW9xmxhRyM22EkGMbmCz/Ay9fMAPjnZipn+QxO0rGGhMhC8dHvYoZfthvw8FRrjJD X-Received: by 10.99.66.130 with SMTP id p124mr14871448pga.0.1509957310058; Mon, 06 Nov 2017 00:35:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1509957310; cv=none; d=google.com; s=arc-20160816; b=DmVg/UWs4HIUlwoCoQEbKL7LAJHhEjAmpOj04lTUhHLcLMOWAURLmUeaMznlZdzwtd yPSAgyoo/BKDb1Ajl+K0UHz2dYzGx3duOi7za/HBjFyLFWu4GRaP8OD4WnAGQvR9OdZF UOIMbo4fOO1uQfmY5b0XoYVwxXr5P8FHVese6ND/UwPo63qSxtTQbb/2F97l3G7ripcf TQmND+r8kWux3AzW/6BCDhUjUl5bAYFntvvEt8dzX8qBAp4cUyMZHKeJ1RHuVuXQGTNJ pmVCNuffkG0dpwD/rpUYkJ4onO9n+1TDnoN7ZDjdyKUfAURtqumO28Bihb2nS+DnCys5 NlGQ== 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=99QFo3d8klxKGvVsNdx5Ot5JugDNu4r8NA5+gZXUvZw=; b=BTKAaVoWyLVxIrdV+4/a8bahpPaqakSN62ZbhM3LDyYeD8KWAwbnyAK5drRfCDX9tX H7fvO12kdjr4nK/tD8NZ8oTPmq5oCJDQHpr0t3uhN9vX7FT4jKf+af0qi+4cQ64vEus1 hRIMl5lkxcRCd62bgx4up6E8p1mWFM6EUpoki1RsKaHF7EW3CfMl9EuCzuCwEAtJaYZ8 gFPKff5cR63JWl9bTnTnYQ+zYe2udCGGI3Juei1HKb19GsIsTyOu2j4a8g4lAMkPosqA BptT7FHLa6lt1FpjMRbPFzk3k8wk2sgTJbzN0CO1jmlvyVly+yt/HPRIGMAm62SPk9SE skIA== 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=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b61si9954820plb.627.2017.11.06.00.34.46; Mon, 06 Nov 2017 00:35:10 -0800 (PST) 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=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751495AbdKFIdk (ORCPT + 98 others); Mon, 6 Nov 2017 03:33:40 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:39746 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750739AbdKFIdj (ORCPT ); Mon, 6 Nov 2017 03:33:39 -0500 Received: from 1.general.apw.uk.vpn ([10.172.192.78] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1eBcqe-00079T-W2; Mon, 06 Nov 2017 08:33:37 +0000 Date: Mon, 6 Nov 2017 08:33:36 +0000 From: Andy Whitcroft To: "Tobin C. Harding" Cc: Joe Perches , linux-kernel@vger.kernel.org Subject: Re: checkpatch potential false positive Message-ID: <20171106083336.ccz5ht77iegqrd6d@brain> References: <20171106041914.GB18478@eros> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171106041914.GB18478@eros> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 06, 2017 at 03:19:14PM +1100, Tobin C. Harding wrote: > Hi, > > When parsing drivers/staging/unisys/visorbus/visorchipset.c in Greg's > staging tree checkpatch emits > > -------------- > visorchipset.c > -------------- > WARNING: char * array declaration might be better as static const > #1050: FILE: visorchipset.c:1050: > + char *envp[] = { env_cmd, env_id, env_state, env_bus, env_dev, > > WARNING: char * array declaration might be better as static const > #1140: FILE: visorchipset.c:1140: > + char *envp[] = { env_selftest, NULL }; > > total: 0 errors, 2 warnings, 1694 lines checked > > I may be wrong but I think the code in question is clean and > correct. Since checkpatch is saying this _might_ be better ... perhaps > checkpatch could emit CHECK instead of WARNING for this? > > Here is the complete function to save finding the file. > > /* > * parahotplug_request_kickoff() - initiate parahotplug request > * @req: the request to initiate > * > * Cause uevent to run the user level script to do the disable/enable specified > * in the parahotplug_request. > */ > static int parahotplug_request_kickoff(struct parahotplug_request *req) > { > struct controlvm_message_packet *cmd = &req->msg.cmd; > char env_cmd[40], env_id[40], env_state[40], env_bus[40], env_dev[40], > env_func[40]; > char *envp[] = { env_cmd, env_id, env_state, env_bus, env_dev, > env_func, NULL > }; > > sprintf(env_cmd, "VISOR_PARAHOTPLUG=1"); > sprintf(env_id, "VISOR_PARAHOTPLUG_ID=%d", req->id); > sprintf(env_state, "VISOR_PARAHOTPLUG_STATE=%d", > cmd->device_change_state.state.active); > sprintf(env_bus, "VISOR_PARAHOTPLUG_BUS=%d", > cmd->device_change_state.bus_no); > sprintf(env_dev, "VISOR_PARAHOTPLUG_DEVICE=%d", > cmd->device_change_state.dev_no >> 3); > sprintf(env_func, "VISOR_PARAHOTPLUG_FUNCTION=%d", > cmd->device_change_state.dev_no & 0x7); > return kobject_uevent_env(&chipset_dev->acpi_device->dev.kobj, > KOBJ_CHANGE, envp); > } > > If this is not the sort of bug report you like, could you please (if you > have time) school me on how to better report such things in the future. > > thanks, > Tobin. I'll let Joe talk to whether this ought to be a CHECK. The function there looks to never modify the envp pointer so some kind of const might well be reasonable as you do not update the pointers. Right? -apw From 1583288982307073975@xxx Mon Nov 06 04:20:37 +0000 2017 X-GM-THRID: 1583288982307073975 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread