From owner-svn-src-head@freebsd.org Wed Jan 4 22:17:31 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8EDB1C9FFE2; Wed, 4 Jan 2017 22:17:31 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-qk0-x244.google.com (mail-qk0-x244.google.com [IPv6:2607:f8b0:400d:c09::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 43A75108F; Wed, 4 Jan 2017 22:17:31 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-qk0-x244.google.com with SMTP id e1so296748qkh.1; Wed, 04 Jan 2017 14:17:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=CGhBoZZ1mBQF4htyJkYVgfit6xiFDAh4RfFIXDZ0QHw=; b=PudqMf3bURN5faUctYnRn5ktBv7q8dpYZcLy/mNpFQBD1JWNz7aTp3H1oDpFwy5WyS yVkmm3R7qQzP/oD1AcYjIDr+YD7G/N9h+8IQJqfoyyL/bFny5cH05VcSXYGLoJ5JG1bT f0ywvEc0NDFkI3V36BNOZtoASW0fErMkoqinsJG9D+M5crmW6Kpmz3zzXJGmZM5ped/G JPH5w7XN0KxUMvoSyE7GAt3b9I9F5GhoRuyYN8fVa8p+cJaia7pjDWZFkqNnQByns4dx E6YHCRnSNR2iDHlZGjr8zXG/2LWN9JG+TmIsmYZ1otHgfzlRHoaYWBqCH+Z4O//NOml6 GVHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=CGhBoZZ1mBQF4htyJkYVgfit6xiFDAh4RfFIXDZ0QHw=; b=RAUNwKpnk+EhTqy3lICUiaNtWWH/RPzhmhdChc2C232Dw3iSfEOX3+OzWJyEu6Qz99 hfKE3zoghwrP3KzKV9BcZkYI+ytYwYKSSm/cQwH5yrD6MGbLHERJEUfjcyFIFb2hNLGA p0ML4au6oNcpHfB708VlTYfiziGTeehwGiZJ2L3aiQVqLCvD1nvpEQ3c0goe9aDZqX+i c71yFGuaXryzsDUmT4Sype6BwWp35d7yED/JGW/ZWN54DIC8x/rWNXlyVnYby6t8qUK7 ALzS7ZDPk8zxUIORDXbgRxp+GBv9GMYR3aNXyqVrB4L1jpxIYTSypZR7buIUQcWGeqAn SyUA== X-Gm-Message-State: AIkVDXJGninoXOPRv5rY1mQxPyrJ6Cw6SC8vGE0x3IjuQxdYBGh3fv8lIwv9OycCm9MR8ez74217fYJ1C9kqfA== X-Received: by 10.55.122.134 with SMTP id v128mr63345511qkc.111.1483568250321; Wed, 04 Jan 2017 14:17:30 -0800 (PST) MIME-Version: 1.0 Received: by 10.140.83.133 with HTTP; Wed, 4 Jan 2017 14:17:29 -0800 (PST) In-Reply-To: <201701042026.v04KQggH076026@repo.freebsd.org> References: <201701042026.v04KQggH076026@repo.freebsd.org> From: Ngie Cooper Date: Wed, 4 Jan 2017 14:17:29 -0800 Message-ID: Subject: Re: svn commit: r311305 - in head/sys: cam cam/ctl cam/scsi dev/aac dev/aacraid dev/advansys dev/aha dev/ahb dev/ahci dev/aic dev/aic7xxx dev/amr dev/arcmsr dev/ata dev/buslogic dev/ciss dev/dpt dev/es... To: Alan Somers Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2017 22:17:31 -0000 On Wed, Jan 4, 2017 at 12:26 PM, Alan Somers wrote: > Author: asomers > Date: Wed Jan 4 20:26:42 2017 > New Revision: 311305 > URL: https://svnweb.freebsd.org/changeset/base/311305 > > Log: > Always null-terminate ccb_pathinq.(sim_vid|hba_vid|dev_name) > > The sim_vid, hba_vid, and dev_name fields of struct ccb_pathinq are > fixed-length strings. AFAICT the only place they're read is in > sbin/camcontrol/camcontrol.c, which assumes they'll be null-terminated. > However, the kernel doesn't null-terminate them. A bunch of copy-pasted code > uses strncpy to write them, and doesn't guarantee null-termination. For at > least 4 drivers (mpr, mps, ciss, and hyperv), the hba_vid field actually > overflows. You can see the result by doing "camcontrol negotiate da0 -v". > > This change null-terminates those fields everywhere they're set in the > kernel. It also shortens a few strings to ensure they'll fit within the > 16-character field. > > PR: 215474 > Reported by: Coverity > CID: 1009997 1010000 1010001 1010002 1010003 1010004 1010005 > CID: 1331519 1010006 1215097 1010007 1288967 1010008 1306000 > CID: 1211924 1010009 1010010 1010011 1010012 1010013 1010014 > CID: 1147190 1010017 1010016 1010018 1216435 1010020 1010021 > CID: 1010022 1009666 1018185 1010023 1010025 1010026 1010027 > CID: 1010028 1010029 1010030 1010031 1010033 1018186 1018187 > CID: 1010035 1010036 1010042 1010041 1010040 1010039 > Reviewed by: imp, sephe, slm > MFC after: 4 weeks > Sponsored by: Spectra Logic Corp > Differential Revision: https://reviews.freebsd.org/D9037 > Differential Revision: https://reviews.freebsd.org/D9038 Awesome -- after I make my pass at bsnmp and netbsd-tests, I'll loop back around to help out with writing tests for cam(3). Cheers, -Ngie