Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3009339imm; Sun, 13 May 2018 02:05:14 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp5a1TeIvrJXohufGASoXvRrXtWQIj4Eah3AB07T8xwQJtU6EzufDdpfz1dErIeNk1QXgEX X-Received: by 2002:a17:902:b68f:: with SMTP id c15-v6mr5342824pls.201.1526202314591; Sun, 13 May 2018 02:05:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526202314; cv=none; d=google.com; s=arc-20160816; b=FOLJ/KAmZhcA7Gk/FwuhDpqtFJemcIN+7Y0S6N8Es6q4NEug7cK1lg6HL4DKQ+DHEs jC9zi/gIrw/XDRhMHwND+VwZIH9sDrmh1LghYZqcNT7w+sW94Uh6nhspncm0v7feM7zY WhWuQLCg1s/cwXoecdqkF3+MYK0hLUCNaXk0lHEiqDC5vpwwmyJ6Zva+yrcUM6Suat6E mUtLLyNR4wFspHPebQ9gVHprA65PpoOw90K0vuKBH4o4ZvzUms1V0dHB3Xl6mBOU1Px4 yOu4O6k4FCReJveWP5d8+o8YyCpU/EsmimVX25iyRXXoww6uJltwcrp3MTLu+uCSILIz bDTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:arc-authentication-results; bh=Ejs5phm94TbjXzR5Y9IEj6U36d2G5g18osINoaEKB4A=; b=LkGMlkD0yNj4kSwKfu9nsIndBeGthflmXIuD1aQnxNrdWStFM87L6yS7tts24msrYc PS8JmbfRwSB9lnvD7/k8KGvhN9qitHwRHelnQJlhc9p4El4Vmb1bQ17uUVN8CfWjbIVM uVkFEeImDS+Rz6xyrMZlwMger+C17Jth/r9trLSP9DtUxCDZeLRrTJvl48S4/fXUCS90 3oTVj1Vo05DJoetXjOKhCyrAvfOABDWW4Q5k2rwHHq3nej194pDI+j1HUD7DlYah+OQi vimlpxczsAU843zG8J3/xizXzdtzL1+8w+59yCC7XfJyPhCdCsE0DEaL0JIIk/tDIKTI K5RA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y15-v6si6176982pli.354.2018.05.13.02.05.00; Sun, 13 May 2018 02:05:14 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751227AbeEMJEt (ORCPT + 99 others); Sun, 13 May 2018 05:04:49 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:33405 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750862AbeEMJEs (ORCPT ); Sun, 13 May 2018 05:04:48 -0400 Received: by mail-wm0-f66.google.com with SMTP id x12-v6so7944964wmc.0; Sun, 13 May 2018 02:04:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=Ejs5phm94TbjXzR5Y9IEj6U36d2G5g18osINoaEKB4A=; b=UWRQDC7ZskTuQUIVXnNX4+cgwbAEORKk19HiJpSpgbIkbK91Dj5L0y7g8fedOC4esq g3OPZxwBh5EuNLUM86IE7DGiUMjmzi+VBaVvYYNqs63cr6w7qt8nR7YMInj7aS13NkBT eh4hNNGgqIr45mWS/l5CB3YVw8yhh9Bf1YnmknsznkL4B6VLt/y1/FNfVGw33iV6pdTP gaqRZZKpAuiDcE/83uQt1h1fyM9UNEF775n4AsxGxLBJyO4lJU0lYzt1TADNiGpJxO6I tgtTgEPiVoRlGKCvWbyh8hFVRnSxb8qrxdwy+ydHv+PqyLwBBFQXwxpl1DzPGyKiCEUD 4hmQ== X-Gm-Message-State: ALKqPwcEDBO3tPVJZM1m61Gg7t8oUR79xDSU2+NloTGwbsrKG5LUgS3A HcfwzcL3OBDOuCRDVozka33C9A== X-Received: by 2002:a1c:6952:: with SMTP id e79-v6mr2903232wmc.76.1526202287051; Sun, 13 May 2018 02:04:47 -0700 (PDT) Received: from [10.0.0.5] ([207.232.55.62]) by smtp.gmail.com with ESMTPSA id l53-v6sm10713902wrc.80.2018.05.13.02.04.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 13 May 2018 02:04:46 -0700 (PDT) Subject: Re: [PATCH] scsi: libosd: Remove VLA usage To: Kees Cook , "Martin K. Petersen" References: <20180502225545.GA45533@beast> Cc: "James E.J. Bottomley" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org From: Boaz Harrosh Message-ID: <6713469a-3f36-6768-c6d7-04edbf8714e8@electrozaur.com> Date: Sun, 13 May 2018 12:04:45 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20180502225545.GA45533@beast> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/05/18 01:55, Kees Cook wrote: > On the quest to remove all VLAs from the kernel[1] this rearranges the > code to avoid a VLA warning under -Wvla (gcc doesn't recognize "const" > variables as not triggering VLA creation). Additionally cleans up variable > naming to avoid 80 character column limit. > > [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qPXydAacU1RqZWA@mail.gmail.com > ACK-BY: Boaz Harrosh > Signed-off-by: Kees Cook > --- > drivers/scsi/osd/osd_initiator.c | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/drivers/scsi/osd/osd_initiator.c b/drivers/scsi/osd/osd_initiator.c > index e18877177f1b..917a86a2ae8c 100644 > --- a/drivers/scsi/osd/osd_initiator.c > +++ b/drivers/scsi/osd/osd_initiator.c > @@ -1842,14 +1842,14 @@ int osd_req_decode_sense_full(struct osd_request *or, > case osd_sense_response_integrity_check: > { > struct osd_sense_response_integrity_check_descriptor > - *osricd = cur_descriptor; > - const unsigned len = > - sizeof(osricd->integrity_check_value); > - char key_dump[len*4 + 2]; /* 2nibbles+space+ASCII */ > - > - hex_dump_to_buffer(osricd->integrity_check_value, len, > - 32, 1, key_dump, sizeof(key_dump), true); > - OSD_SENSE_PRINT2("response_integrity [%s]\n", key_dump); > + *d = cur_descriptor; > + /* 2nibbles+space+ASCII */ > + char dump[sizeof(d->integrity_check_value) * 4 + 2]; > + > + hex_dump_to_buffer(d->integrity_check_value, > + sizeof(d->integrity_check_value), > + 32, 1, dump, sizeof(dump), true); > + OSD_SENSE_PRINT2("response_integrity [%s]\n", dump); > } > case osd_sense_attribute_identification: > { >