From owner-freebsd-current@freebsd.org Thu Sep 20 20:23:12 2018 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8996510A8CD8 for ; Thu, 20 Sep 2018 20:23:12 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic314-20.consmr.mail.gq1.yahoo.com (sonic314-20.consmr.mail.gq1.yahoo.com [98.137.69.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 07CB17E5A7 for ; Thu, 20 Sep 2018 20:23:11 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: hldD.FoVM1mbl3Flxt3PcdblI0DWEnBLVoA4z9tajcm6Z84Q6JHu1LMsCPhiTUn Hjq397PoKCvu5IT0MG9rbxnLlI9opFrY6DhCZNwKvjtqS5QI5vF38.DLAKVMyO.VSBWytczUQg2u FA09CXNlfTEG6n9Gt5KJCPeeV9_JjwYLVoy3X5Qjx0_XwEOzsGiWBlUGY_mC1tcCNR_Z5QqLDccp 8a7Y29q8Ieyv796LP1qpIqq.8L0ltJTPVJkEMp4FElsFMSaJI2J2t5IpsnRdX92s17Bx_8jsWdGE VrRbaWPIHADtvN.v6sCPwRk70v72opdSsgw6_iJK86eg.jS9oK8HyUT3rsplre5oQLRxWGf8AkQB BHuZ0wHacx9DQcP.Xfm0Rm_8GYV8w.SHDm1qr6_NCzUk0W6W9fZ6YN_iHxL.MB5hoBC.LkDZoGKr 8umyeUWjySEEDK_8wkx9lSBlrfMq4JvY1hRqg09Iwa_PLjNiF7ngaYKrxPRJIbhuwmArTLzCSBpL mqfbjpg_uZC0igcgCHcRdYvDgc1p3xJ9O9SJWveBfXo1Wr0Xfcft5Do0BZ08V.PmDdw5Ic4920RE .JIrS0YBGQUN6cDq6gihulPY_PYB16aLlgiyaw.pzrtbAe3Tjr476f8Wd0ofNBVXowf7Q3.GuFIJ zAH.a_EXC7VinWitT4ocx47E8w0yLpZFtya.zHRMlRuIRBjIBUfq4oa5B1yYf5z9sijK67_dn_Rj oTUdYp5FOCPkEO3T5lUK0mBGctG6nE7WTvi42RnDB7GmZF0xrJidBxH7yz3Aal3he4ZVaNKoNCmB USVGgjZl2YkKKQpwZPL_rQMjplStUbGFLQi.jfnsB9MEMBbMSjHBSYgCsjQkGk3a_ePammiz6rIo CfsQiyZTR74qEv1UPKGPwHdR.qHCVoxD3e6LY_wlcEQpJW3bjujgyAcR1mceMmNDNQL_cQiGpudx d1l.l6_1t.A.v_S0O61PnDs7Nvo57M4U2W.RrxRmTml4qjVN8ZEEFWXzdsfRvx3b1PDDw96YzFDD cCjVigvda Received: from sonic.gate.mail.ne1.yahoo.com by sonic314.consmr.mail.gq1.yahoo.com with HTTP; Thu, 20 Sep 2018 20:23:10 +0000 Received: from ip70-189-131-151.lv.lv.cox.net (EHLO [192.168.0.105]) ([70.189.131.151]) by smtp415.mail.gq1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 6eeb75c21f392daf911b8d7c31fc3ebb; Thu, 20 Sep 2018 20:23:06 +0000 (UTC) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: Use of cbp->tbd[-1].tb_size in /usr/src/sys/dev/fxp/if_fxp.c : clang 7 rejects it Message-Id: <3EBF1660-6CD5-4C80-A36D-4DE945073006@yahoo.com> Date: Thu, 20 Sep 2018 13:23:05 -0700 To: yongari@FreeBSD.org, FreeBSD Current X-Mailer: Apple Mail (2.3445.9.1) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Sep 2018 20:23:12 -0000 The sources listed here are from head -r338675 . /usr/src/sys/dev/fxp/if_fxpreg.h:297 is in: struct fxp_cb_tx { uint16_t cb_status; uint16_t cb_command; uint32_t link_addr; uint32_t tbd_array_addr; uint16_t byte_count; uint8_t tx_threshold; uint8_t tbd_number; /* * The following structure isn't actually part of the TxCB, * unless the extended TxCB feature is being used. In this * case, the first two elements of the structure below are * fetched along with the TxCB. */ union { struct fxp_ipcb ipcb; struct fxp_tbd tbd[FXP_NTXSEG + 1]; } tx_cb_u; }; /usr/src/sys/dev/fxp/if_fxp.c:1630 is in: /* Configure TSO. */ if (m->m_pkthdr.csum_flags & CSUM_TSO) { cbp->tbd[-1].tb_size =3D htole32(m->m_pkthdr.tso_segsz << = 16); cbp->tbd[1].tb_size |=3D htole32(tcp_payload << 16); cbp->ipcb_ip_schedule |=3D FXP_IPCB_LARGESEND_ENABLE | FXP_IPCB_IP_CHECKSUM_ENABLE | FXP_IPCB_TCP_PACKET | FXP_IPCB_TCPUDP_CHECKSUM_ENABLE; } But this cbp->tbd[-1].tb_size use goes back to -r185330 in 2008-Nov-26. This is also when the "+ 1" was added to the: struct fxp_tbd tbd[FXP_NTXSEG + 1] above. clang 7's report was: --- if_fxp.o --- /usr/src/sys/dev/fxp/if_fxp.c:1630:3: error: array index -1 is before = the beginning of the array [-Werror,-Warray-bounds] cbp->tbd[-1].tb_size =3D htole32(m->m_pkthdr.tso_segsz << = 16); ^ ~~ /usr/src/sys/dev/fxp/if_fxpreg.h:297:3: note: array 'tbd' declared here struct fxp_tbd tbd[FXP_NTXSEG + 1]; ^ 1 error generated. *** [if_fxp.o] Error code 1 It does look odd to me. =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)